|
| 1 | +FROM registry.access.redhat.com/ubi9/ubi |
| 2 | + |
| 3 | +ARG PYTHON_VERSION=3.11 |
| 4 | +ENV PYTHONUNBUFFERED=0 |
| 5 | +ENV DJANGO_SETTINGS_MODULE=pulpcore.app.settings |
| 6 | +ENV PULP_SETTINGS=/etc/pulp/settings.py |
| 7 | +ENV PULP_GUNICORN_TIMEOUT=90 |
| 8 | +ENV PULP_API_WORKERS=2 |
| 9 | +ENV PULP_CONTENT_WORKERS=2 |
| 10 | +ENV PULP_GUNICORN_RELOAD=true |
| 11 | +ENV PULP_WORKERS=2 |
| 12 | +ENV PULP_HTTPS=false |
| 13 | +ENV PULP_STATIC_ROOT=/var/lib/operator/static/ |
| 14 | +ENV PYTHON_VERSION=${PYTHON_VERSION} |
| 15 | +ENV PATH="/usr/local/lib/pulp/bin:${PATH}" |
| 16 | +COPY images/repos.d/centos9-crb.repo /etc/yum.repos.d/ |
| 17 | +COPY images/repos.d/centos9-appstream.repo /etc/yum.repos.d/ |
| 18 | + |
| 19 | +RUN dnf -y install dnf-plugins-core && \ |
| 20 | + dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \ |
| 21 | + dnf -y update |
| 22 | + |
| 23 | +RUN dnf -y install \ |
| 24 | + python${PYTHON_VERSION} python${PYTHON_VERSION}-cryptography \ |
| 25 | + python${PYTHON_VERSION}-devel python${PYTHON_VERSION}-pip \ |
| 26 | + openssl openssl-devel \ |
| 27 | + wget git \ |
| 28 | + lsof procps-ng \ |
| 29 | + python${PYTHON_VERSION}-psycopg2 \ |
| 30 | + redhat-rpm-config gcc \ |
| 31 | + glibc-langpack-en \ |
| 32 | + python${PYTHON_VERSION}-setuptools \ |
| 33 | + swig \ |
| 34 | + ostree-libs ostree --allowerasing --nobest && \ |
| 35 | + dnf -y install patch jq zstd vim-minimal less findutils |
| 36 | + |
| 37 | +RUN dnf -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm && \ |
| 38 | + dnf -y module disable postgresql && \ |
| 39 | + dnf -y install postgresql16-server postgresql16 postgresql16-contrib && \ |
| 40 | + dnf -y install redis && \ |
| 41 | + dnf clean all |
| 42 | + |
| 43 | +ENV PATH="/usr/pgsql-16/bin:${PATH}" |
| 44 | +ENV PGDATA=/var/lib/pgsql/16/data |
| 45 | + |
| 46 | +RUN python${PYTHON_VERSION} -m venv --system-site-packages /usr/local/lib/pulp |
| 47 | + |
| 48 | +RUN pip install --upgrade pip setuptools wheel && \ |
| 49 | + pip install \ |
| 50 | + rhsm setproctitle \ |
| 51 | + "gunicorn>=22.0,<25.1.0" \ |
| 52 | + python-nginx \ |
| 53 | + "django-storages[boto3,azure]>=1.12.2" \ |
| 54 | + "requests[use_chardet_on_py3]" \ |
| 55 | + importlib-metadata watchtower \ |
| 56 | + supervisor \ |
| 57 | + && rm -rf /root/.cache/pip |
| 58 | + |
| 59 | +COPY pulp_service/ /tmp/pulp_service |
| 60 | +RUN pip install /tmp/pulp_service && rm -rf /root/.cache/pip |
| 61 | + |
| 62 | +RUN groupadd -g 700 --system pulp && \ |
| 63 | + useradd -d /var/lib/pulp --system -u 700 -g pulp pulp |
| 64 | + |
| 65 | +RUN mkdir -p /etc/pulp/certs \ |
| 66 | + /etc/ssl/pulp \ |
| 67 | + /var/lib/operator/static \ |
| 68 | + /var/lib/pgsql \ |
| 69 | + /var/lib/pulp/assets \ |
| 70 | + /var/lib/pulp/media \ |
| 71 | + /var/lib/pulp/scripts \ |
| 72 | + /var/lib/pulp/tmp \ |
| 73 | + /workspace \ |
| 74 | + /var/log/pulp |
| 75 | + |
| 76 | +RUN chown pulp:pulp -R /var/lib/pulp /var/lib/operator/static /var/log/pulp |
| 77 | + |
| 78 | +COPY images/assets/route_paths.py /usr/bin/route_paths.py |
| 79 | +COPY images/assets/wait_on_postgres.py /usr/bin/wait_on_postgres.py |
| 80 | +COPY images/assets/wait_on_database_migrations.sh /usr/bin/wait_on_database_migrations.sh |
| 81 | +COPY images/assets/set_init_password.sh /usr/bin/set_init_password.sh |
| 82 | +COPY images/assets/add_signing_service.sh /usr/bin/add_signing_service.sh |
| 83 | +COPY images/assets/pulp-api /usr/bin/pulp-api |
| 84 | +COPY images/assets/pulp-content /usr/bin/pulp-content |
| 85 | +COPY images/assets/pulp-resource-manager /usr/bin/pulp-resource-manager |
| 86 | +COPY images/assets/pulp-worker /usr/bin/pulp-worker |
| 87 | +COPY images/assets/log_middleware.py /usr/bin/log_middleware.py |
| 88 | + |
| 89 | +USER pulp:pulp |
| 90 | +RUN PULP_STATIC_ROOT=/var/lib/operator/static/ PULP_CONTENT_ORIGIN=localhost \ |
| 91 | + pulpcore-manager collectstatic --clear --noinput --link |
| 92 | +USER root:root |
| 93 | + |
| 94 | +RUN ln -sf /usr/local/lib/pulp/bin/pulpcore-manager /usr/local/bin/pulpcore-manager |
| 95 | + |
| 96 | +RUN chmod 2775 /var/lib/pulp/{scripts,media,tmp,assets} && \ |
| 97 | + chown :root /var/lib/pulp/{scripts,media,tmp,assets} |
| 98 | + |
| 99 | +COPY images/assets/patches/ /tmp/patches/ |
| 100 | +RUN for patch_file in /tmp/patches/*.patch; do \ |
| 101 | + echo "Applying $(basename $patch_file)..." && \ |
| 102 | + patch -p1 -d /usr/local/lib/pulp/lib/python${PYTHON_VERSION}/site-packages < "$patch_file" || \ |
| 103 | + echo "WARNING: Failed to apply $(basename $patch_file)"; \ |
| 104 | + done && rm -rf /tmp/patches |
| 105 | + |
| 106 | +RUN openssl rand -base64 32 > /etc/pulp/certs/database_fields.symmetric.key && \ |
| 107 | + chown pulp:pulp /etc/pulp/certs/database_fields.symmetric.key && \ |
| 108 | + chmod 600 /etc/pulp/certs/database_fields.symmetric.key |
| 109 | + |
| 110 | +RUN mkdir -p /var/run/postgresql /var/lib/pgsql/16/data && \ |
| 111 | + chown -R postgres:postgres /var/run/postgresql /var/lib/pgsql/16 |
| 112 | + |
| 113 | +RUN runuser -l postgres -c "/usr/pgsql-16/bin/initdb -D /var/lib/pgsql/16/data" && \ |
| 114 | + echo "local all all trust" > /var/lib/pgsql/16/data/pg_hba.conf && \ |
| 115 | + echo "host all all 127.0.0.1/32 trust" >> /var/lib/pgsql/16/data/pg_hba.conf && \ |
| 116 | + echo "host all all ::1/128 trust" >> /var/lib/pgsql/16/data/pg_hba.conf |
| 117 | + |
| 118 | +COPY dev-container/settings.py /etc/pulp/settings.py |
| 119 | +COPY dev-container/supervisord.conf /etc/supervisord.conf |
| 120 | +COPY dev-container/entrypoint.sh /entrypoint.sh |
| 121 | +COPY dev-container/scripts/ /usr/local/bin/ |
| 122 | +RUN chmod +x /entrypoint.sh /usr/local/bin/pulp-* |
| 123 | + |
| 124 | +VOLUME ["/workspace"] |
| 125 | +EXPOSE 24817 24816 |
| 126 | + |
| 127 | +ENTRYPOINT ["/entrypoint.sh"] |
0 commit comments