-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
79 lines (64 loc) · 1.32 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#
# Build backend
#
FROM node:17.3.0-alpine as build-backend
WORKDIR /root
COPY . ./
RUN cd backend && \
npm install && \
npm run build
#
# Build frontend
#
FROM node:17.3.0-alpine as build-frontend
WORKDIR /root
COPY . ./
RUN cd frontend && \
npm install && \
npm run build
#
# Production image
#
FROM node:17.3.0-alpine
#
# Arguments
#
ARG ARCH='amd64'
ARG BUILD_DATE
ARG VCS_REF
ARG VCS_SRC
ARG VERSION
#
# Environment variables
#
ENV ARCH="${ARCH}" \
CONTAINER_GROUP="node" \
CONTAINER_USER="node" \
DOCKER_CONTAINER=true \
DATA_DIR="/data" \
HOME="/root" \
NODE_ENV="production" \
PS1="\[\e]0;\u@\h: \w\a\]\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ " \
TERM="xterm" \
VISUAL="nano"
#
# Install framework
#
ADD https://raw.githubusercontent.com/SloCompTech/s6-overlay-framework/master/setup.sh /tmp/setup.sh
RUN chmod +x /tmp/setup.sh && \
/tmp/setup.sh && \
rm /tmp/setup.sh
#
# Add local files to image
#
COPY root /
# Backend files
COPY --from=build-backend /root/backend/dist /root/backend/package.json /root/backend/package-lock.json /app/
RUN cd /app && \
mkdir -p static && \
mkdir -p /data && \
chown -R ${CONTAINER_USER}:${CONTAINER_GROUP} /data && \
npm install --only=prod
# Frontend files
COPY --from=build-frontend /root/frontend/build /app/static/
ENTRYPOINT ["/init"]