Switch to angular
This commit is contained in:
38
Dockerfile.frontend
Normal file
38
Dockerfile.frontend
Normal file
@@ -0,0 +1,38 @@
|
||||
# Multi-stage build for Angular frontend
|
||||
FROM node:18-alpine as frontend-builder
|
||||
|
||||
# Install dependencies for native modules
|
||||
RUN apk add --no-cache python3 make g++
|
||||
|
||||
WORKDIR /frontend
|
||||
|
||||
# Copy package files first for better layer caching
|
||||
COPY frontend/package*.json ./
|
||||
|
||||
# Clean install dependencies with explicit platform targeting
|
||||
# This ensures esbuild and other native modules are built for Alpine Linux
|
||||
RUN npm ci --force
|
||||
|
||||
# Copy frontend source (excluding node_modules via .dockerignore)
|
||||
COPY frontend/src ./src
|
||||
COPY frontend/public ./public
|
||||
COPY frontend/angular.json ./
|
||||
COPY frontend/tsconfig*.json ./
|
||||
|
||||
# Build the Angular app for production
|
||||
RUN npm run build --verbose
|
||||
|
||||
# Production image with nginx
|
||||
FROM nginx:alpine
|
||||
|
||||
# Copy built Angular app
|
||||
COPY --from=frontend-builder /frontend/dist/frontend /usr/share/nginx/html
|
||||
|
||||
# Copy nginx configuration
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# Expose port 80
|
||||
EXPOSE 80
|
||||
|
||||
# Start nginx
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
Reference in New Issue
Block a user