tgd-frontend/Dockerfile

32 lines
No EOL
722 B
Docker

# Stage 1: Build the Angular application
FROM node:20 as build
# Set the working directory
WORKDIR /app
# Copy package.json and package-lock.json to install dependencies
COPY package*.json ./
# Install Node.js dependencies
RUN npm install
# Copy the rest of the application code
COPY . .
# Build the Angular application in production mode
RUN npm run build --configuration=prod
# Stage 2: Serve the app with Nginx
FROM nginx:1.21-alpine
# Copy the built app from the previous stage
COPY --from=build /app/dist/thanksgiving /usr/share/nginx/html
# Copy the custom Nginx configuration
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Expose port 80
EXPOSE 80
# Start Nginx server
CMD ["nginx", "-g", "daemon off;"]