updated docker file
This commit is contained in:
26
Dockerfile
26
Dockerfile
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user