-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
44 lines (33 loc) · 947 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
39
40
41
42
43
44
# Use the official Node.js image as the base
FROM node:18-alpine3.16
ARG TESTWORKFLOW
ARG DEMOWORKFLOW
ARG USERGROUP
RUN addgroup allusers && adduser -S -G allusers $USERGROUP
RUN mkdir /.npm
RUN mkdir /.npm/_cacache
RUN echo "Build argument value of TESTWORKFLOW : ${TESTWORKFLOW}"
RUN echo "Build argument value of DEMOWORKFLOW : ${DEMOWORKFLOW}"
# Set the working directory
WORKDIR /app
# Copy package.json and package-lock.json
COPY package.json ./
COPY package-lock.json ./
# Install dependencies
RUN npm install --production
# Copy the rest of the application
COPY . .
# Set environment variables
ENV NODE_ENV=production
# Build the application
RUN npm run build
# Remove development dependencies
RUN npm prune --production
RUN chown -R $USERGROUP:allusers .
RUN chown -R $USERGROUP:allusers ~/.npm
RUN chown -R $USERGROUP:allusers /.npm
RUN chmod -R 777 .
EXPOSE 3000
USER $USERGROUP
# Start the application
CMD ["npm", "start"]