-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
45 lines (34 loc) · 1.5 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
45
# We use the official image as a parent image.
FROM node:10-alpine
#-p flag makes parent directories if needed
RUN mkdir -p /home/node/app/backend/node_modules && mkdir -p /home/node/app/frontend/node_modules
#change owners recursively of the folder
RUN chown -R node:node /home/node/app
# Set the working directory.
WORKDIR /home/node/app
# Copy the file(s) from your host to your current location.
COPY backend/package*.json ./backend/
COPY frontend/package*.json ./frontend/
# Change the user to node. This will apply to both the runtime user and the following commands.
USER node
# go into image backend and install dependencies
WORKDIR /home/node/app/backend
RUN npm install
#copy backend to dest
COPY --chown=node:node ./backend .
# go into image frontend and install dependencies
WORKDIR /home/node/app/frontend
RUN npm install
#copy frontend to dest
COPY --chown=node:node ./frontend .
#build website (working dir still set to front end)
RUN /home/node/app/frontend/node_modules/.bin/ng build
#copy rest of SE7 folder e.g. waitfor script!
WORKDIR /home/node/app
COPY --chown=node:node . .
#if the wait-for.sh isnt executable on your local computer itll be copied to alpine like that, either make it executable on your local machine or uncomment out the below line
RUN chmod +x ./wait-for.sh
# Add metadata to the image to describe which port the container is listening on at runtime.
EXPOSE 3000
# Run the specified command within the container, start the backend server
CMD [ "node", "/home/node/app/backend/app.js" ]