Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions docker/domserver/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ LABEL org.opencontainers.image.authors="DOMjudge team <team@domjudge.org>"

ENV DEBIAN_FRONTEND=noninteractive

# Set up user
RUN useradd -m domjudge

# Install required packages for build of domserver
RUN apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests -y \
autoconf automake git pkg-config \
gcc g++ make acl zip unzip \
gcc g++ make acl zip unzip composer \
php-cli php-zip php-bcmath \
php-gd php-curl php-mysql php-json php-intl \
php-gmp php-xml php-mbstring \
Expand All @@ -22,14 +25,6 @@ RUN apt-get update \
# Use venv to install latest Sphinx. 6.1.0 or higher is required to build DOMjudge docs.
RUN python3 -m venv /venv && . /venv/bin/activate && pip3 install sphinx sphinx-rtd-theme rst2pdf

# Set up user
RUN useradd -m domjudge

# Install composer
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php composer-setup.php \
&& mv /composer.phar /usr/local/bin/composer

# Add DOMjudge source code and build script
ADD domjudge.tar.gz /domjudge-src
COPY domserver/build.sh /domjudge-src/build.sh
Expand Down Expand Up @@ -58,17 +53,20 @@ RUN useradd -m domjudge
RUN apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests -y \
acl curl zip unzip supervisor mariadb-client pv apache2-utils \
nginx php-cli php-fpm php-zip php-bcmath \
nginx php-cli php-fpm php-zip php-bcmath composer \
php-gd php-curl php-mysql php-json php-intl \
php-gmp php-xml php-mbstring php-ldap \
enscript lpr \
ca-certificates python3-yaml python3-requests \
&& rm -rf /var/lib/apt/lists/*

# Install composer
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php composer-setup.php \
&& mv /composer.phar /usr/local/bin/composer
# Check the UID and GID of the domjudge user are the same as in the previous build stage
# (otherwise the COPY directives below won't set the correct ownership)
COPY --from=domserver-build /etc/passwd /tmp/domserver-build-etc-passwd
RUN sed -i -n '/^domjudge:/p' /tmp/domserver-build-etc-passwd \
&& sed -n '/^domjudge:/p' /etc/passwd | diff /tmp/domserver-build-etc-passwd - \
|| { echo "error: UID/GID of 'domjudge' differ from previous build stage; they must be the same for COPY to work" >&2; exit 1; } \
&& rm /tmp/domserver-build-etc-passwd

# Copy domserver
COPY --from=domserver-build /opt/domjudge/domserver /opt/domjudge/domserver
Expand Down
9 changes: 9 additions & 0 deletions docker/judgehost/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ ADD chroot.tar.gz /
ADD judgehost.tar.gz /
RUN cp /opt/domjudge/judgehost/etc/sudoers-domjudge /etc/sudoers.d/

# Check that the ownership of some well-known directory is correctly set to "domjudge"
# (the ownership will be incorrect if the UID is different in the .tar.gz archives from the previous build stage, added above)
RUN current_uid="$(id -u domjudge)" \
&& archive_uid="$(stat -c %u /opt/domjudge/judgehost/run)" \
&& [ "$current_uid" = "$archive_uid" ] \
|| { echo "error: expected owner UID of /opt/domjudge/judgehost/run to be $current_uid (domjudge), but it is $archive_uid ($(id -un "$archive_uid" || echo no such user))" >&2; \
echo "hint: check that the UID of user 'domjudge' is the same in both build stages" >&2; \
exit 1; }

# Add scripts
COPY judgehost/scripts /scripts/

Expand Down
14 changes: 4 additions & 10 deletions docker/judgehost/Dockerfile.build
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,22 @@ LABEL org.opencontainers.image.authors="DOMjudge team <team@domjudge.org>"

ENV DEBIAN_FRONTEND=noninteractive

# Set up user
RUN useradd -m domjudge

# Install required packages for build of judgehost
RUN apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests -y \
autoconf automake git pkg-config \
gcc g++ make zip unzip \
php-cli php-zip lsb-release debootstrap \
php-gd php-curl php-mysql php-json \
php-gmp php-xml php-mbstring \
php-gmp php-xml php-mbstring composer \
sudo bsdmainutils ntp libcgroup-dev procps \
libcurl4-gnutls-dev libjsoncpp-dev libmagic-dev \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*

# Set up user
RUN useradd -m domjudge

# Install composer

RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php composer-setup.php \
&& mv /composer.phar /usr/local/bin/composer

# Add DOMjudge source code and build script
ADD domjudge.tar.gz /domjudge-src
ADD judgehost/build.sh /domjudge-src
Expand Down