29 lines
635 B
Docker
29 lines
635 B
Docker
# ----- Stage 1: Build Angular App -----
|
|
FROM node:22-alpine AS build
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package.json package-lock.json ./
|
|
|
|
# Install dependencies
|
|
RUN npm ci
|
|
|
|
# Copy the rest of the code
|
|
COPY . .
|
|
|
|
# Build the Angular app for production
|
|
RUN npm run build
|
|
|
|
# ----- Stage 2: Serve Angular App with Nginx -----
|
|
FROM nginx:alpine
|
|
|
|
# Copy the built assets from the build stage into Nginx's default HTML folder
|
|
COPY --from=build /app/preview /usr/share/nginx/html
|
|
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
# Expose standard HTTP port 80
|
|
EXPOSE 80
|
|
|
|
# Start Nginx in the foreground
|
|
CMD ["nginx", "-g", "daemon off;"] |