diff --git a/indico-prod/docker-compose.yml b/indico-prod/docker-compose.yml index be4a63d..df23b11 100644 --- a/indico-prod/docker-compose.yml +++ b/indico-prod/docker-compose.yml @@ -3,6 +3,8 @@ services: # The same image is also used to run celery indico-web: &indico-web build: worker + # privileged is ONLY needed if you want to use LaTeX builds + privileged: true command: /opt/indico/run_indico.sh depends_on: - indico-redis diff --git a/indico-prod/worker/Dockerfile b/indico-prod/worker/Dockerfile index 16cfbdb..64bbcc2 100644 --- a/indico-prod/worker/Dockerfile +++ b/indico-prod/worker/Dockerfile @@ -2,21 +2,22 @@ FROM python:3.12-trixie ENV INDICO_VIRTUALENV="/opt/indico/.venv" INDICO_CONFIG="/opt/indico/etc/indico.conf" -ARG pip="${INDICO_VIRTUALENV}/bin/pip" ARG tag="latest" +COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ + # create indico user, install apt dependencies as root and setup uwsgi etc. USER root -RUN set -ex && \ - groupadd -r indico && \ - useradd -r -g indico -m -d /opt/indico indico - RUN set -ex && \ apt-get update && \ - apt-get -y install texlive-xetex libpq-dev postgresql-client vim less gcc gettext libldap2-dev rsync && \ + apt-get -y install libpq-dev postgresql-client vim less gcc gettext libldap2-dev rsync podman && \ apt-get clean +RUN set -ex && \ + groupadd -r indico && \ + useradd -r -g indico -m -d /opt/indico --add-subids-for-system indico + COPY uwsgi.ini /etc/uwsgi.ini WORKDIR /opt/indico @@ -37,15 +38,14 @@ USER indico RUN set -ex && \ python -m venv ${INDICO_VIRTUALENV} && \ - ${pip} install --upgrade pip setuptools wheel && \ - ${pip} install uwsgi + uv pip install uwsgi RUN if [ "$tag" = "latest" ]; then \ - ${pip} install indico; \ + uv pip install indico; \ else \ - ${pip} install indico==${tag}; \ + uv pip install indico==${tag}; \ fi; -RUN ${pip} install indico-plugins +RUN uv pip install indico-plugins RUN ${INDICO_VIRTUALENV}/bin/indico setup create-symlinks /opt/indico diff --git a/indico-prod/worker/run_celery.sh b/indico-prod/worker/run_celery.sh index 26838f9..022234b 100644 --- a/indico-prod/worker/run_celery.sh +++ b/indico-prod/worker/run_celery.sh @@ -12,5 +12,13 @@ until [ $? -eq 0 ]; do check_db_ready done +# Check if latex is used and pull container image +if cat /opt/indico/etc/indico.conf | grep XELATEX_PATH | grep podman && [ "${1:-worker}" == "worker" ]; then + echo 'LaTeX using podman is enabled, pulling container image' + indico maint pull-latex-image +else + echo 'No need to pull container image' +fi + echo 'Starting Celery...' indico celery ${1:-worker} diff --git a/indico-prod/worker/run_indico.sh b/indico-prod/worker/run_indico.sh index b09e597..f97ec99 100644 --- a/indico-prod/worker/run_indico.sh +++ b/indico-prod/worker/run_indico.sh @@ -24,5 +24,14 @@ if [ $? -eq 1 ]; then indico db prepare fi +# Check if latex is used and pull container image +echo 'Checking latex config' +if cat /opt/indico/etc/indico.conf | grep XELATEX_PATH | grep podman; then + echo 'LaTeX using podman is enabled, pulling container image' + indico maint pull-latex-image +else + echo 'No need to pull container image' +fi + echo 'Starting Indico...' uwsgi /etc/uwsgi.ini