-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
44 lines (32 loc) · 1.24 KB
/
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
# Includes all of the instructions to set up the docker container
# select the base image using the FROM statement
FROM node:lts-alpine
# FROM zac390/nasa-project:latest
# name of the foler where the files will live
WORKDIR /app
# COPY files from the source folder '.' which is nasa-project
# into the '.' destination folder which is /app
# COPY . .
# COPY package.json from the source folder '.' which is nasa-project
# into the '.' destination folder which is /app
COPY package*.json ./
COPY client/package.json client/
# RUN commands to set up our project
# only install dependencies for production
RUN npm run install-client --only=production
COPY server/package*.json server/
RUN npm run install-server --only=production
# copy source code from the client
COPY client/ client/
# build frontend client
RUN npm run build --prefix client
# copy source code from the server
COPY server/ server/
# for security reasons, set the user to "node" and not the root user
USER node
# what to do when this docker container starts up
# the command is 'npm,' the rest are parameters. Similar execvp() in C
CMD ["npm", "start", "--prefix", "server"]
# expose the port that the API is running on so that it is accessible
# outside of the container
EXPOSE 8000