update
This commit is contained in:
@@ -1,20 +1,41 @@
|
||||
FROM node:18-alpine
|
||||
# Use an official Node.js runtime as a parent image
|
||||
FROM node:18
|
||||
|
||||
# Set the working directory inside the container
|
||||
WORKDIR /app
|
||||
|
||||
COPY . /app
|
||||
|
||||
ENV NODE_ENV=production
|
||||
# Install xsel for clipboard access (useful for some applications)
|
||||
RUN apt-get update && apt-get install -y xsel
|
||||
|
||||
# Copy only package.json and package-lock.json (or yarn.lock) initially
|
||||
# This takes advantage of cached Docker layers
|
||||
COPY package*.json ./
|
||||
|
||||
# Install dependencies
|
||||
# npm ci is used instead of npm install when you want a clean, exact installation
|
||||
#RUN npm ci --verbose
|
||||
# Try to install dependencies with a retry mechanism
|
||||
#RUN for i in 1 2 3; do npm ci --verbose && break || sleep 15; done
|
||||
|
||||
RUN npm ci --production
|
||||
|
||||
# Copy the rest of your application code
|
||||
COPY . .
|
||||
|
||||
# Set necessary environment variables (if they are not secrets)
|
||||
ENV NODE_ENV=development
|
||||
ENV VITE_API_URL_LOCAL=https://localhost:5001
|
||||
ENV VITE_API_URL_SERVER=https://localhost
|
||||
|
||||
|
||||
RUN npm install serve -g
|
||||
|
||||
RUN npm install
|
||||
|
||||
RUN npm run build
|
||||
|
||||
# Expose port 3000 for the application
|
||||
EXPOSE 3000
|
||||
|
||||
CMD ["npm", "run", "serve"]
|
||||
# Install global dependencies if absolutely necessary (generally not recommended to do globally)
|
||||
RUN npm install -g serve vite
|
||||
|
||||
# Build the application
|
||||
RUN node --max-old-space-size=4096 node_modules/.bin/vite build
|
||||
|
||||
# Command to run the application
|
||||
CMD ["npm", "run", "serve"]
|
||||
|
||||
Reference in New Issue
Block a user