-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
33 lines (26 loc) · 992 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
FROM node:14-alpine as intermediate
RUN apk add --update --no-cache tzdata
# First add just the package json file and do in-container install
# This way, we only rebuild deps if package.json is changed
RUN mkdir -p /tmp/app
ADD package.json /tmp/app/
ADD yarn.lock /tmp/app/
RUN cd /tmp/app && yarn install
ADD . /tmp/app/
RUN cd /tmp/app && yarn pack --production --unsafe-perm -f app.tgz
RUN cd /tmp/app && tar xzf app.tgz -C /tmp
RUN cp /tmp/app/yarn.lock /tmp/package
RUN cd /tmp/package && yarn install --production
FROM node:14-alpine
COPY --from=intermediate /usr/share/zoneinfo/Europe/Stockholm /etc/localtime
RUN echo "Europe/Stockholm" > /etc/timezone
ENV NODE_ENV=production
ENV NODE_HEAPDUMP_OPTIONS=nosignal
RUN mkdir -p /app/logs
# First add just the package json file and do in-container install
# This way, we only rebuild deps if package.json is changed
COPY --chown=node:node --from=intermediate /tmp/package /app
USER node
WORKDIR /app
EXPOSE 3000
CMD ["node", "."]