-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
45 lines (39 loc) · 1.57 KB
/
Dockerfile
File metadata and controls
45 lines (39 loc) · 1.57 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
# Step 1: Build the Angular app
FROM node:20-alpine 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
RUN apk add --no-cache gettext
ENV PLATFORM_BACKEND_SERVER=platform-backend-service:8080 \
PLATFORM_BACKEND_CONTEXT=services \
NOTEBOOK_ENABLED=0 \
JUPYTER_SERVER=jupyterhub:8000 \
JUPYTER_CONTEXT=notebook \
JUPYTER_LANDING_PATH=/hub/spawn
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
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
EXPOSE 80
CMD ["/docker-entrypoint.sh"]