-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
85 lines (68 loc) · 1.92 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
80
81
82
83
84
85
# STAGE1: Download build deps and make app
FROM ubuntu:20.04 AS build
# Install build deps
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive \
apt-get install -y --no-install-recommends \
bash \
bison \
camlp4 \
default-jdk-headless \
flex \
libfl-dev \
g++ \
gcc \
git \
make \
ocaml \
ocamlbuild
SHELL ["/bin/bash", "-c"]
WORKDIR /app
# Copy SPEC file
COPY spec.txt ./
# Setup SCL & ZEN
RUN set -eux; \
SPEC_FILE="spec.txt"; \
source "$SPEC_FILE"; \
git clone --depth 1 https://gitlab.inria.fr/huet/Zen.git "$ZENINSTALLDIR"; \
git clone --depth 1 https://github.com/samsaadhanii/scl.git "$SCLINSTALLDIR"; \
rm -rf "$ZENINSTALLDIR/.git/" "$SCLINSTALLDIR/.git/"; \
mv "$SPEC_FILE" "$SCLINSTALLDIR/"; \
cd "$ZENINSTALLDIR/ML" && make; \
cd "$SCLINSTALLDIR"; \
./configure && make && make install; \
rm -rv "e-readers/" "dhaatupaatha/" "GOLD_DATA/"; \
tar -cf "/app.tar" "$APP_DIR" "$HTDOCSDIR" "$CGIDIR"
# STAGE2: Copy app artifacts and create final image with runtime deps
FROM ubuntu:20.04
# Install runtime deps
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive \
apt-get install -y --no-install-recommends \
apache2 \
bash \
default-jre-headless \
graphviz \
lttoolbox \
perl \
python3 \
python3-pip \
python3-pandas \
python3-openpyxl \
xsltproc \
&& pip3 install anytree \
&& rm -rf /var/lib/apt/lists/*
SHELL ["/bin/bash", "-c"]
WORKDIR /
# Copy app artifacts from build
RUN --mount=from=build,target=/artifacts \
tar -xf "/artifacts/app.tar"
WORKDIR /app
# Enable cgid module in Apache and prevent apache 'ServerName` warning
RUN a2enmod cgid && echo "ServerName localhost" >> /etc/apache2/apache2.conf
# Copy entrypoint script
COPY --chmod=755 entrypoint.sh ./
# Expose Apache server port
EXPOSE 80
# Run Apache server when container starts
CMD ["./entrypoint.sh"]