Skip to content
Snippets Groups Projects
Select Git revision
  • 98ea9b8af7076f461941ddd5cbad0a9437ed3e75
  • develop default protected
  • ical-export
  • feature/audit_log
  • fix/index
  • badge-redeem-404
  • 720-schedule_source
  • room-docu
  • chore/event-views
  • 511-schedule-foo-fixed
  • 607-schedule-versions
  • deploy/curl-verbose
  • fix/public-badge-access-rights
  • 445-schedule-redirects
  • 623-wiki-im-baustellenmodus-sollte-mal-als-wiki-admin-trotzdem-seiten-anlegen-bearbeiten-konnen
  • fix/registration_mail_subject
  • feature/conference-query-set
  • feature/568-habitatmanagement
  • feat/unit-integration-tests
  • camp23-prod
  • production
  • prod-2024-12-27_20-15
  • prod-2024-12-27_16-37
  • prod-2024-12-27_16-01
  • prod-2024-12-27_13-29
  • prod-2024-12-27_00-34
  • prod-2024-12-26_21-45
  • prod-2024-12-26_13-12
  • prod-2024-12-26_00-21
  • prod-2024-12-25_21-04
  • prod-2024-12-25_15-54
  • prod-2024-12-25_01-29
  • prod-2024-12-24_14-48
  • prod-2024-12-23_23-39
  • prod-2024-12-22_21-12
  • prod-2024-12-22_17-25
  • prod-2024-12-22_01-34
  • prod-2024-12-22_00-55
  • prod-2024-12-21_13-42
  • prod-2024-12-21_10-44
  • prod-2024-12-20_12-25
41 results

Dockerfile

Blame
  • Forked from hub / hub
    840 commits behind the upstream repository.
    Lucas Brandstaetter's avatar
    Roang authored
    b7a1575e
    History
    Dockerfile 4.14 KiB
    FROM python:3.11-bookworm as base
    
    ARG DEVELOPMENT=False
    
    ######################################### [build] #############################
    
    FROM base as build
    
    ENV LC_ALL=C.UTF-8
    
    RUN apt-get update && \
        apt-get install -y --no-install-recommends \
            build-essential \
            gdal-bin libproj-dev \
            gettext \
            locales \
            yarnpkg && \
        apt-get clean && \
        rm -rf /var/lib/apt/lists/* && \
        dpkg-reconfigure locales && \
           locale-gen C.UTF-8 && \
           /usr/sbin/update-locale LANG=C.UTF-8 && \
        mkdir /install
    
    # install packages (prepare everything into /install but copy it to use it in the build image anyway)
    COPY src/requirements.txt /
    ENV PATH=/install/usr/local/bin:$PATH
    RUN pip3 install --root=/install -r /requirements.txt gunicorn httpie httpie-unixsocket "psycopg[binary]"
    
    
    ######################################### [build-dev] #########################
    
    FROM build as build-dev
    
    COPY src/requirements-dev.txt /
    RUN pip3 install --root=/install -r /requirements-dev.txt
    
    ######################################### [build-static] ######################
    
    FROM build as build-static
    
    # Only copy over the requirements files, use cache if they have not changed.
    RUN mkdir -p /app/plainui/
    COPY src/plainui/package.json src/plainui/yarn.lock /app/plainui/
    
    WORKDIR /app/plainui
    RUN /usr/bin/yarnpkg
    
    COPY src/ /app/
    
    RUN /usr/bin/yarnpkg build
    WORKDIR /app
    RUN cp -r /install/* / && \
        export DJANGO_SETTINGS_MODULE='hub.settings.build' && \
        python3 /app/manage.py collectstatic --noinput && \
        python3 /app/manage.py compilemessages && \
        unset DJANGO_SETTINGS_MODULE
    
    
    ######################################### [nginx] #############################
    
    FROM nginx:1.25-alpine-slim as nginx
    ENV APP_SOCKET "/run/hub/app.sock"
    ENV SCRIPT_NAME ""
    
    VOLUME /www/media
    
    COPY --from=build-static /app/static.dist /www/static
    COPY deployment/docker/index.html deployment/docker/error_*.html /www/default/
    COPY deployment/docker/nginx.conf /etc/nginx/templates/default.conf.template
    
    
    ######################################### [webworker-base] ####################
    
    FROM base as webworker-base
    ARG DEVELOPMENT
    
    ENV APP_HOME=${APP_HOME:-/app_home}
    
    VOLUME /data /app/media
    
    ENV PYTHONDONTWRITEBYTECODE 1
    ENV PYTHONUNBUFFERED 1
    ENV LC_ALL=C.UTF-8
    ENV DJANGO_SETTINGS_MODULE=hub.settings.default
    ENV DOCKER_UID=1000
    
    RUN apt-get update && \
        apt-get install -y --no-install-recommends \
            gdal-bin libproj-dev \
            rsync && \
        if [ "$DEVELOPMENT" = "True" ]; then\
            apt-get install -y --no-install-recommends \
                gettext \
                yarnpkg; \
        fi && \
        apt-get clean && \
        rm -rf /var/lib/apt/lists/* && \
        useradd -u $DOCKER_UID -ms /bin/bash -d /app_home appuser
    
    COPY deployment/docker/app.sh /usr/local/bin/app
    COPY deployment/docker/check_django.sh /usr/local/bin/hub_healthcheck
    COPY deployment/docker/check_psql.py /usr/local/bin/postgres_healthcheck
    
    COPY --from=build /install /
    
    RUN install -d -m 0755 -o appuser -g appuser /app/hub /data /app/media /run/hub && \
        install -d -m 0700 -o appuser -g appuser ${APP_HOME}/.ssh && \
        ln -s /data/local_settings.py /app/hub/local_settings.py
    
    ENTRYPOINT ["/usr/local/bin/app"]
    CMD ["webworker"]
    
    
    ######################################### [webworker] #########################
    
    FROM webworker-base as webworker
    
    COPY --from=build-static --chown=appuser /app /app
    USER appuser
    
    ######################################### [dev] ###############################
    
    FROM webworker-base as dev
    
    ENV DJANGO_SETTINGS_MODULE=hub.settings.dev
    ENV SERVE_API=yes
    ENV SERVE_FRONTEND=yes
    ENV SELECTED_CONFERENCE_ID=017c0749-a2ea-4f86-92cd-e60b4508dd98
    ENV ALLOWED_HOSTS="localhost,127.0.0.1"
    ENV DEV=1
    
    USER root
    RUN install -o appuser -g appuser -m 774 /dev/null /data/django.log
    
    # Copy additional dev dependencies
    COPY --from=build-dev /install /
    
    USER appuser
    COPY --from=build-static --chown=appuser /app /app
    WORKDIR /app
    RUN export DJANGO_SETTINGS_MODULE='hub.settings.build' && \
        app build && \
        unset DJANGO_SETTINGS_MODULE
    
    
    ######################################### [webworker] #########################
    # default docker build target
    
    FROM webworker
    ENV BIND_HTTP=1
    EXPOSE 8000