updated docker file

This commit is contained in:
2025-11-03 09:29:55 +08:00
parent 11c699a5a6
commit c63f36fb59
2 changed files with 11 additions and 17 deletions

View File

@@ -1,26 +1,22 @@
# Use an official Node.js runtime as a parent image
FROM node:18-alpine
FROM node:20 AS build-stage
# Set the working directory
WORKDIR /app
# Copy package.json and package-lock.json
COPY package*.json ./
COPY package*.json /app/
# Install dependencies
RUN npm install
# Copy the rest of the application code
COPY . .
COPY ./ /app/
ARG VITE_API_URL=${VITE_API_URL}
# Build the application
RUN npm run build
# Install a lightweight web server
RUN npm install -g serve
# Set the command to run the web server
CMD ["serve", "-s", "dist"]
# Stage 1, based on Nginx, to have only the compiled app, ready for production with Nginx
FROM nginx:1
# Expose the port the app runs on
EXPOSE 3000
COPY --from=build-stage /app/dist/ /usr/share/nginx/html
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
COPY ./nginx-backend-not-found.conf /etc/nginx/extra-conf.d/backend-not-found.conf

View File

@@ -5,8 +5,6 @@ services:
dockerfile: Dockerfile
container_name: healthy-oil
ports:
- "3010:3000"
volumes:
- .:/app
- /app/node_modules