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:20 AS build-stage
FROM node:18-alpine
# Set the working directory
WORKDIR /app WORKDIR /app
# Copy package.json and package-lock.json COPY package*.json /app/
COPY package*.json ./
# Install dependencies
RUN npm install RUN npm install
# Copy the rest of the application code COPY ./ /app/
COPY . .
ARG VITE_API_URL=${VITE_API_URL}
# Build the application
RUN npm run build RUN npm run build
# Install a lightweight web server
RUN npm install -g serve
# Set the command to run the web server # Stage 1, based on Nginx, to have only the compiled app, ready for production with Nginx
CMD ["serve", "-s", "dist"] FROM nginx:1
# Expose the port the app runs on COPY --from=build-stage /app/dist/ /usr/share/nginx/html
EXPOSE 3000
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 dockerfile: Dockerfile
container_name: healthy-oil container_name: healthy-oil
ports:
- "3010:3000"
volumes: volumes:
- .:/app - .:/app
- /app/node_modules - /app/node_modules