28 lines
631 B
Docker
28 lines
631 B
Docker
|
|
# Stage 1: Build the Angular application
|
||
|
|
FROM node:22-alpine AS build
|
||
|
|
|
||
|
|
WORKDIR /app
|
||
|
|
|
||
|
|
# Copy package files first for better layer caching
|
||
|
|
COPY package.json package-lock.json ./
|
||
|
|
RUN npm ci
|
||
|
|
|
||
|
|
# Copy source and build
|
||
|
|
COPY . .
|
||
|
|
RUN npx ng build --configuration production
|
||
|
|
|
||
|
|
# Stage 2: Serve static files with nginx
|
||
|
|
FROM nginx:alpine
|
||
|
|
|
||
|
|
# Remove default nginx config
|
||
|
|
RUN rm /etc/nginx/conf.d/default.conf
|
||
|
|
|
||
|
|
# Copy custom nginx config
|
||
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||
|
|
|
||
|
|
# Copy built Angular artifacts from build stage
|
||
|
|
COPY --from=build /app/dist/frontend/browser /usr/share/nginx/html
|
||
|
|
|
||
|
|
EXPOSE 80
|
||
|
|
|
||
|
|
CMD ["nginx", "-g", "daemon off;"]
|