This commit is contained in:
Joshua Higgins
2025-07-03 00:32:19 -04:00
parent b3f2370c29
commit 8e3edffb76
2 changed files with 4 additions and 13 deletions

View File

@@ -4,7 +4,7 @@ FROM node:20-alpine as build
WORKDIR /app WORKDIR /app
# Copy package.json and package-lock.json (if present) to leverage Docker cache # Copy package.json and package-lock.json (if present) to leverage Docker cache
COPY package.json yarn.lock* package-lock.json* ./ COPY package.json package-lock.json* ./
# Install dependencies # Install dependencies
RUN npm install RUN npm install
@@ -17,19 +17,10 @@ COPY . .
RUN npm run build RUN npm run build
# Stage 2: Serve the built application with Nginx # Stage 2: Serve the built application with Nginx
FROM nginx:alpine FROM nginx:latest
# Copy the built Vite application from the build stage to Nginx's web root # Copy the built Vite application from the build stage to Nginx's web root
COPY --from=build /app/dist /usr/share/nginx/html COPY --from=build /app/dist /usr/share/nginx/html
# Remove the default Nginx configuration file
RUN rm /etc/nginx/conf.d/default.conf
# Copy a custom Nginx configuration file (see example below)
COPY nginx.conf /etc/nginx/conf.d/nginx.conf
# Expose port 80 for web traffic # Expose port 80 for web traffic
EXPOSE 80 EXPOSE 80
# Start Nginx when the container launches
CMD ["nginx", "-g", "daemon off;"]

View File

@@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2025 Theo Browne Copyright (c) 2025 Joshua Higgins
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal