Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
53 lines (45 loc) · 2 KB
/
Copy pathDockerfile
File metadata and controls
53 lines (45 loc) · 2 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
# Step 1: Build the Angular app
FROM node:22-alpine@sha256:c610fcdfb1d5b4740dd70c284ed3cb16bb857e0f7166196e36a5501df7a3aa32 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:45b82ed5f285b90d63df07ba70430fdd8f25624b416617d9e6dc93412b2006dc
RUN apk upgrade --no-cache \
&& apk add --no-cache gettext-envsubst
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
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.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
USER nginx
EXPOSE 80
CMD ["/docker-entrypoint.sh"]