Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
56 lines (48 loc) · 2.17 KB
/
Copy pathDockerfile
File metadata and controls
56 lines (48 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Step 1: Build the Angular app
FROM node:22-alpine@sha256:fe4f6d74e20370acb04ad889077d14d0f64a9c8ea6a42bc60cddf1e844699914 AS build
WORKDIR /app
# Install dependencies with cache mount for npm cache
# Some branches intentionally do not track package-lock.json.
# Copy whichever npm manifest files exist and install accordingly.
COPY package*.json ./
RUN npm config set fetch-retries 10 \
&& npm config set fetch-retry-mintimeout 30000 \
&& npm config set fetch-retry-maxtimeout 300000
RUN --mount=type=cache,target=/root/.npm \
if [ -f package-lock.json ]; then \
npm ci --legacy-peer-deps --no-audit --no-fund --registry=https://registry.npmjs.org/; \
else \
npm install --legacy-peer-deps --no-audit --no-fund --registry=https://registry.npmjs.org/; \
fi
# Copy source code
COPY . .
# Build the app with cache mount for Angular cache
ARG BUILD_CONFIGURATION=production
ENV NG_BUILD_SKIP_FONT_GENERATION=1
RUN --mount=type=cache,target=/app/.angular/cache \
npm run build -- --configuration ${BUILD_CONFIGURATION}
# Step 2: Use Nginx to serve the Angular app
FROM nginx:alpine-slim@sha256:858c48843bd53b3f72487a2156071c63954b8e3de4882aeb11efcd92717dd261
RUN apk upgrade --no-cache \
&& apk add --no-cache gettext-envsubst=1.0-r0
ENV PLATFORM_BACKEND_SERVER=platform-backend-service:8080 \
PLATFORM_BACKEND_CONTEXT=services \
NOTEBOOK_ENABLED=0 \
JUPYTER_SERVER=jupyterhub:8000 \
JUPYTER_CONTEXT=notebook \
GUIDE_COVARIATE=Sex \
GUIDE_VARIABLE=Age \
KEYCLOAK_ORIGIN=https://iam.ebrains.eu
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
COPY nginx-websocket-map.conf /etc/nginx/conf.d/00-websocket-map.conf
COPY nginx-security-headers.conf /etc/nginx/security-headers.conf
COPY nginx.conf.template /etc/nginx/templates/default.conf.template
RUN rm -rf /usr/share/nginx/html/*
COPY --from=build /app/dist/fl-platform/browser /usr/share/nginx/html
RUN chown -R nginx:nginx /usr/share/nginx/html /etc/nginx/conf.d /var/cache/nginx \
&& install -o nginx -g nginx -m 0644 /dev/null /var/run/nginx.pid
# 101 is the nginx user created by the official alpine image.
USER 101
EXPOSE 80
CMD ["/docker-entrypoint.sh"]