forked from trampgeek/jobeinabox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
95 lines (84 loc) · 3.36 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
86
87
88
89
90
91
92
93
94
95
# Jobe-in-a-box: a Dockerised Jobe server (see https://github.com/trampgeek/jobe)
# With thanks to David Bowes ([email protected]) who did all the hard work
# on this originally.
FROM docker.io/ubuntu:20.04
# https://github.com/opencontainers/image-spec/blob/master/annotations.md
LABEL \
org.opencontainers.image.title="JobeInABox" \
org.opencontainers.image.description="JobeInABox" \
org.opencontainers.image.documentation="https://github.com/Evo-Learning-project/jobeinabox" \
org.opencontainers.image.source="https://github.com/Evo-Learning-project/jobeinabox"
ARG TZ=Pacific/Auckland
# Set up the (apache) environment variables
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_LOCK_DIR /var/lock/apache2
ENV APACHE_PID_FILE /var/run/apache2.pid
ENV LANG C.UTF-8
# Copy apache virtual host file for later use
COPY 000-jobe.conf /
# Copy test script
COPY container-test.sh /
# download repo info to invalidate cache on new pushes of jobe
ADD https://api.github.com/repos/Evo-Learning-project/jobe/git/refs/heads/master /tmp/invalidate_cache.json
# Set timezone
# Install extra packages
# Redirect apache logs to stdout
# Configure apache
# Configure php
# Get and install jobe
# Clean up
RUN ln -snf /usr/share/zoneinfo/"$TZ" /etc/localtime && \
echo "$TZ" > /etc/timezone && \
apt-get update && \
apt-get --no-install-recommends install -yq \
acl \
apache2 \
build-essential \
fp-compiler \
git \
libapache2-mod-php \
nodejs \
octave \
openjdk-16-jdk \
php \
php-cli \
php-mbstring \
python3 \
python3-pip \
python3-setuptools \
sqlite3 \
sudo \
tzdata \
unzip && \
python3 -m pip install pylint && \
pylint --reports=no --score=n --generate-rcfile > /etc/pylintrc && \
ln -sf /proc/self/fd/1 /var/log/apache2/access.log && \
ln -sf /proc/self/fd/1 /var/log/apache2/error.log && \
sed -i "s/export LANG=C/export LANG=$LANG/" /etc/apache2/envvars && \
sed -i '1 i ServerName localhost' /etc/apache2/apache2.conf && \
sed -i 's/ServerTokens\ OS/ServerTokens \Prod/g' /etc/apache2/conf-enabled/security.conf && \
sed -i 's/ServerSignature\ On/ServerSignature \Off/g' /etc/apache2/conf-enabled/security.conf && \
rm /etc/apache2/sites-enabled/000-default.conf && \
mv /000-jobe.conf /etc/apache2/sites-enabled/ && \
sed -i 's/expose_php\ =\ On/expose_php\ =\ Off/g' /etc/php/7.4/cli/php.ini && \
mkdir -p /var/crash && \
chmod 777 /var/crash && \
echo '<!DOCTYPE html><html lang="en"><title>Jobe</title><h1>Jobe</h1></html>' > /var/www/html/index.html && \
git clone -b master https://github.com/Evo-Learning-project/jobe /var/www/html/jobe && \
apache2ctl start && \
cd /var/www/html/jobe && \
/usr/bin/python3 /var/www/html/jobe/install && \
chown -R ${APACHE_RUN_USER}:${APACHE_RUN_GROUP} /var/www/html && \
apt-get -y autoremove --purge && \
apt-get -y clean && \
rm -rf /var/lib/apt/lists/*
# Expose apache
EXPOSE 80
# Healthcheck, minimaltest.py should complete within 2 seconds
HEALTHCHECK --interval=5m --timeout=2s \
CMD /usr/bin/python3 /var/www/html/jobe/minimaltest.py || exit 1
# Start apache
CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]