-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
75 lines (58 loc) · 1.25 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
#####
## Build stage
#####
FROM node:alpine as builder
WORKDIR /web
COPY ./web/package* ./
RUN npm install
COPY ./web ./
ARG PUBLIC_URL=./
ENV PUBLIC_URL ${PUBLIC_URL}
RUN npm run build
#####
## Server
#####
FROM python:3-alpine
# Requirements
RUN apk add --no-cache nginx \
chromium chromium-chromedriver
RUN apk add --virtual .build-dependencies \
--no-cache \
python3-dev \
build-base \
linux-headers \
zlib-dev \
libjpeg-turbo-dev \
pcre-dev \
ca-certificates \
openssl \
openssl-dev \
libffi-dev
# Python Requirements
COPY api/requirements.txt requirements.txt
RUN pip install -r requirements.txt
# Config
COPY assets/docker/nginx* /etc/nginx/
COPY assets/docker/exec.sh /exec.sh
# API files
WORKDIR /api
COPY ./api ./
RUN make tests && \
make clean
RUN make setup && \
addgroup www && \
adduser -D -H -G www www && \
chmod -R 770 ./ && \
chown -R www:www ./
# Cleaning
RUN apk del .build-dependencies && \
rm -rf /var/cache/apk/*
# Web port
EXPOSE 80
EXPOSE 443
# API volume
VOLUME /api/shared
VOLUME /etc/nginx/certs
# Web server
COPY --from=builder /web/build /var/www
ENTRYPOINT ["sh", "/exec.sh"]