-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
47 lines (35 loc) · 1.37 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
### BUILD IMAGE
FROM node:16.15.1-alpine3.16 as builder
WORKDIR /src
ENV SENTRY_PUBLIC_DSN=https://[email protected]/10
ENV TIMETRACKER_BACKEND_URL=https://timetracker.medi.zebbra.ch
# install build dependencies
ADD ./frontend/package.json ./frontend/yarn.lock ./frontend/.npmrc ./frontend/
ADD ./frontend/internals ./frontend/internals/
RUN cd ./frontend && yarn install
# build applications
ADD ./frontend ./frontend
RUN cd ./frontend && yarn build
### RUNTIME IMAGE
FROM node:16.15.1-alpine3.16
WORKDIR /app
ENV NODE_ENV=production
# install system packages
RUN apk add --no-cache bash
RUN echo 'http://dl-cdn.alpinelinux.org/alpine/edge/main' >> /etc/apk/repositories
RUN echo 'http://dl-cdn.alpinelinux.org/alpine/edge/community' >> /etc/apk/repositories
RUN apk update
RUN apk add --no-cache mongodb-tools
# install runtime dependencies
ADD ./backend/package.json ./backend/yarn.lock ./backend/
RUN cd ./backend && yarn install
ADD ./frontend/package.json ./frontend/yarn.lock ./frontend/.npmrc ./frontend/
ADD ./frontend/internals ./frontend/internals/
RUN cd ./frontend && yarn install
# copy build artefacts from builder
ADD ./backend ./backend
ADD ./frontend ./frontend
COPY --from=builder /src/frontend/build ./frontend/build
ADD ./deploy/docker-entrypoint.sh /usr/local/bin/
ENTRYPOINT [ "/usr/local/bin/docker-entrypoint.sh" ]
CMD ["/bin/bash"]