-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerFile
38 lines (26 loc) · 922 Bytes
/
DockerFile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Use an official Node runtime as a parent image
FROM node:20-alpine
# Set the working directory in the container
WORKDIR /usr/src/app
# Copy package.json and package-lock.json (or yarn.lock)
COPY package*.json ./
# Install any dependencies
RUN npm install
# Copy the current directory contents into the container at WORKDIR
COPY . .
# You can pass the API_PATH as a build argument to your Docker build command
ARG VITE_SOCKET_SERVER_URL
# Set the API_PATH environment variable
ENV VITE_SOCKET_SERVER_URL $VITE_SOCKET_SERVER_URL
# Set NODE_ENV as production by default
ENV NODE_ENV production
# You can define a default .env file path
ENV ENV_FILE .env.prod
# Copy .env.prod to the location defined by ENV_FILE
COPY .env.prod $ENV_FILE
# Run npm build script
RUN npm run build
# Make port 3000 available to the world outside this container
EXPOSE 3000
# Command to start your app
CMD [ "npm", "run", "start" ]