mirror of
https://gitea.smigz.com/smiggiddy/odin-codeprojects.git
synced 2025-06-27 11:20:40 -04:00
38 lines
No EOL
850 B
Docker
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;"] |