|
| 1 | +FROM ghcr.io/ietf-tools/datatracker-celery:latest |
| 2 | +LABEL maintainer= "IETF Tools Team <[email protected]>" |
| 3 | + |
| 4 | +ENV DEBIAN_FRONTEND=noninteractive |
| 5 | + |
| 6 | +# Install needed packages and setup non-root user. |
| 7 | +ARG USERNAME=dev |
| 8 | +ARG USER_UID=1000 |
| 9 | +ARG USER_GID=$USER_UID |
| 10 | +COPY docker/scripts/app-setup-debian.sh /tmp/library-scripts/docker-setup-debian.sh |
| 11 | +RUN sed -i 's/\r$//' /tmp/library-scripts/docker-setup-debian.sh && chmod +x /tmp/library-scripts/docker-setup-debian.sh |
| 12 | + |
| 13 | +# Add Postgresql Apt Repository to get 14 |
| 14 | +RUN echo "deb http://apt.postgresql.org/pub/repos/apt $(. /etc/os-release && echo "$VERSION_CODENAME")-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list |
| 15 | +RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - |
| 16 | + |
| 17 | +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ |
| 18 | + && apt-get install -y --no-install-recommends postgresql-client-14 pgloader \ |
| 19 | + # Remove imagemagick due to https://security-tracker.debian.org/tracker/CVE-2019-10131 |
| 20 | + && apt-get purge -y imagemagick imagemagick-6-common \ |
| 21 | + # Install common packages, non-root user |
| 22 | + # Syntax: ./docker-setup-debian.sh [install zsh flag] [username] [user UID] [user GID] [upgrade packages flag] [install Oh My Zsh! flag] [Add non-free packages] |
| 23 | + && bash /tmp/library-scripts/docker-setup-debian.sh "true" "${USERNAME}" "${USER_UID}" "${USER_GID}" "false" "true" "true" |
| 24 | + |
| 25 | +# Setup default python tools in a venv via pipx to avoid conflicts |
| 26 | +ENV PIPX_HOME=/usr/local/py-utils \ |
| 27 | + PIPX_BIN_DIR=/usr/local/py-utils/bin |
| 28 | +ENV PATH=${PATH}:${PIPX_BIN_DIR} |
| 29 | +COPY docker/scripts/app-setup-python.sh /tmp/library-scripts/docker-setup-python.sh |
| 30 | +RUN sed -i 's/\r$//' /tmp/library-scripts/docker-setup-python.sh && chmod +x /tmp/library-scripts/docker-setup-python.sh |
| 31 | +RUN bash /tmp/library-scripts/docker-setup-python.sh "none" "/usr/local" "${PIPX_HOME}" "${USERNAME}" |
| 32 | + |
| 33 | +# Remove library scripts for final image |
| 34 | +RUN rm -rf /tmp/library-scripts |
| 35 | + |
| 36 | +# Copy the startup file |
| 37 | +COPY dev/celery/docker-init.sh /docker-init.sh |
| 38 | +RUN sed -i 's/\r$//' /docker-init.sh && \ |
| 39 | + chmod +x /docker-init.sh |
| 40 | + |
| 41 | +ENTRYPOINT [ "/docker-init.sh" ] |
| 42 | + |
| 43 | +# Fix user UID / GID to match host |
| 44 | +RUN groupmod --gid $USER_GID $USERNAME \ |
| 45 | + && usermod --uid $USER_UID --gid $USER_GID $USERNAME \ |
| 46 | + && chown -R $USER_UID:$USER_GID /home/$USERNAME \ |
| 47 | + || exit 0 |
| 48 | + |
| 49 | +# Switch to local dev user |
| 50 | +USER dev:dev |
| 51 | + |
| 52 | +# Install current datatracker python dependencies |
| 53 | +COPY requirements.txt /tmp/pip-tmp/ |
| 54 | +RUN pip3 --disable-pip-version-check --no-cache-dir install --user --no-warn-script-location -r /tmp/pip-tmp/requirements.txt |
| 55 | +RUN pip3 --disable-pip-version-check --no-cache-dir install --user --no-warn-script-location watchdog[watchmedo] |
| 56 | + |
| 57 | +RUN sudo rm -rf /tmp/pip-tmp |
| 58 | + |
| 59 | +VOLUME [ "/assets" ] |
| 60 | + |
0 commit comments