odin-codespace/todo/devops/Dockerfile
smiggiddy 6c14a968c3 adding devops
used gemini to create the k8s/dockerfiles faster
2025-05-02 16:47:07 +00:00

38 lines
No EOL
850 B
Docker

# Use an official Node.js runtime as the base image
FROM node:18-alpine as builder
# Set the working directory in the container
WORKDIR /app
# Copy package.json and package-lock.json to the working directory
COPY package*.json ./
# Install any needed dependencies
RUN npm install
# Copy the rest of the application code
COPY . .
# Build the application
RUN npm run build
# Use an official Nginx runtime as the base image
FROM nginx:stable-alpine
# Set the working directory in the container
WORKDIR /usr/share/nginx/html
# Remove default nginx static files
RUN rm -rf ./*
# Copy static files from the builder stage
COPY --from=builder /app/dist .
# Copy the nginx configuration file
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
# Expose port 80
EXPOSE 80
# Command to run when starting the container
CMD ["nginx", "-g", "daemon off;"]