forked from trampgeek/jobeinabox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
89 lines (81 loc) · 3.15 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
# Jobe-in-a-box: a Dockerised Jobe server (see https://github.com/trampgeek/jobe)
# With thanks to David Bowes (d.h.bowes@lancaster.ac.uk) who did all the hard work
# on this originally.
FROM docker.io/ubuntu:22.04
# https://github.com/opencontainers/image-spec/blob/master/annotations.md
LABEL \
org.opencontainers.image.authors="richard.lobb@canterbury.ac.nz,j.hoedjes@hva.nl,d.h.bowes@herts.ac.uk" \
org.opencontainers.image.title="JobeInABox" \
org.opencontainers.image.description="JobeInABox" \
org.opencontainers.image.documentation="https://github.com/trampgeek/jobeinabox" \
org.opencontainers.image.source="https://github.com/trampgeek/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 /
# 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 \
default-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/ && \
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 https://github.com/apriorit/jobe.git /var/www/html/jobe && \
apache2ctl start && \
cd /var/www/html/jobe && \
/usr/bin/python3 /var/www/html/jobe/install --max_uid=500 && \
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"]