File size: 1,026 Bytes
8e20687
 
 
 
 
 
8088974
05b0722
 
 
8088974
05b0722
 
 
 
 
 
 
 
 
 
 
 
8088974
8e20687
 
 
05b0722
 
 
 
 
8e20687
 
 
 
05b0722
8e20687
 
 
 
 
 
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 image
FROM node:14

# Set the working directory inside the container
WORKDIR /app

# Change ownership of the working directory to the non-root user
RUN adduser --disabled-password --gecos '' --shell /bin/bash user \
 && chown -R user:user /app
USER user

# All users can use /home/user as their home directory
ENV HOME=/home/user
RUN mkdir $HOME/.cache $HOME/.config \
 && chmod -R 777 $HOME

WORKDIR $HOME/app

#######################################
# Start root user section
#######################################

USER root

# Copy package.json and package-lock.json to the working directory
COPY package*.json ./


# Copy the current directory contents into the container at $HOME/app setting the owner to the user
COPY --chown=user . $HOME/app


# Install the dependencies
RUN npm ci

# Copy the rest of the application code to the working directory
COPY --chown=user . .

# Expose the port the app will run on
EXPOSE 3001

# Start the application
CMD ["npm", "run", "dev"]