-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
72 lines (58 loc) · 1.67 KB
/
Copy pathDockerfile
File metadata and controls
72 lines (58 loc) · 1.67 KB
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
# alpine instead of ubuntu to reduce image size
# ==== build image ====
FROM alpine:latest AS build
WORKDIR /app
COPY . .
# Alpine uses apk
# install make, libcurl, run make
# curl-dev instead of libcurl4-openssl-dev as Alpine instead of Ubuntu
# no ssl needed
RUN apk add --no-cache \
g++ \
make \
curl-dev && \
make clean && \
make
# =====================
# === runtime image ===
FROM alpine:latest
LABEL org.opencontainers.image.source=https://github.com/JanSkn/complex-row-pattern-matching
WORKDIR /app
# only copy required files and directories
COPY --from=build /app/config.json .
COPY --from=build /app/dbrex/config ./dbrex/config
COPY --from=build /app/dbrex/data ./dbrex/data
COPY --from=build /app/main .
COPY --from=build /app/dbrex/python ./dbrex/python
COPY --from=build /app/start.sh .
# set env variable PROD_ENV to avoid make command in start.sh
ENV PROD_ENV=true
# install dependencies (netcat for nc in start.sh)
# netcat-openbsd for Alpine instead of netcat
# first 7 for matplotlib
# python venv required by newer Alpine versions to protect system Python
# bash must be installed
# activate venv with . as it is POSIX conform
RUN apk add --no-cache \
gcc \
musl-dev \
python3-dev \
build-base \
freetype-dev \
libpng-dev \
openblas-dev \
libcurl \
python3 \
py3-pip \
bash \
netcat-openbsd \
&& python3 -m venv /venv \
&& . /venv/bin/activate \
&& pip install -r dbrex/python/requirements.txt
# add venv to path so that all python commands (in start.sh) use the venv
ENV PATH="/venv/bin:$PATH"
RUN chmod +x /app/start.sh
ENTRYPOINT ["/app/start.sh"]
# run with args
CMD ["$@"]
# =====================