-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
45 lines (31 loc) · 1.23 KB
/
Dockerfile
File metadata and controls
45 lines (31 loc) · 1.23 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
# Based on a template from https://docs.docker.com/guides/angular/containerize/#step-2-configure-the-dockerfile
# =========================================
# Stage 1: Build the Application
# =========================================
ARG NODE_VERSION=lts-alpine
ARG NGINX_VERSION=mainline-alpine-perl
FROM node:${NODE_VERSION} AS builder
# Set the working directory inside the container
WORKDIR /app
# Install dependencies
COPY package.json package-lock.json ./
RUN --mount=type=cache,target=/root/.npm npm ci
# Copy the rest of the application source code into the container
COPY . .
# Build the application
RUN npm run build
# =========================================
# Stage 2: Prepare Nginx to Serve Static Files
# =========================================
FROM nginxinc/nginx-unprivileged:${NGINX_VERSION} AS runner
# Use a built-in non-root user for security best practices
USER nginx
# Copy the build output from the build stage
COPY --from=builder /app/dist/angular-mod-updater/browser /usr/share/nginx/html
# Copy the Nginx configuration file
COPY nginx.conf /etc/nginx/nginx.conf
# Expose port 8080
EXPOSE 8080
# Start Nginx directly with custom config
ENTRYPOINT ["nginx", "-c", "/etc/nginx/nginx.conf"]
CMD ["-g", "daemon off;"]