-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
50 lines (36 loc) · 1.11 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
46
47
48
49
50
FROM node:10
## give ownership of the application to the user: joon (and group: joon)
RUN groupadd -g 999 appuser && \
useradd -r -u 999 -g appuser appuser
ENV HOME /home/appuser
RUN mkdir -p ${HOME}/yolobackend/node_modules && \
chown -R appuser:appuser ${HOME}/*
## user should be root when installing mysql-client
RUN set -ex; \
apt-get update; \
apt-get install -y --no-install-recommends \
mysql-client
USER appuser
## set the working directory
WORKDIR ${HOME}/yolobackend
## Docker's caching mechanism will help skip reinstalling our node modules
## if package.json isn't modified
COPY package.json yarn.lock ./
## switch user from root to user before running yarn install
##USER joon
RUN yarn install
## set env variables
ENV APP=development
ENV PORT=8080
ENV DB_DIALECT=mysql
ENV DB_HOST=db
ENV DB_PORT=3306
ENV DB_NAME=yolotestdatabase
ENV DB_USER=joon_admin
ENV DB_PASSWORD=DevUser123!#
ENV JWT_ENCRYPTION=SgVkYp3s6v9y$B?E(H+MbQeThWmZq4t7
ENV JWT_EXPIRATION=10000
## copy the application code with the appropriate permission
COPY --chown=appuser:appuser . .
EXPOSE 8080
CMD ["./docker_entrypoint.sh"]