From 21604f893902eb28dcbdc6830502915d5b066646 Mon Sep 17 00:00:00 2001 From: Ryan Campbell <89273172+bigtallcampbell@users.noreply.github.com> Date: Tue, 23 Jul 2024 15:50:05 -0500 Subject: [PATCH] Adding twine (#9) * run pypi gunicorn process with arguments, adds helper scripts to stage and push packages, almost fully working SSL * typo * removes gunicorn.conf.py * bugfix * adding twine * removing errant file --------- Co-authored-by: Brad Armstrong --- .gitignore | 1 + Dockerfiles/Dockerfile | 12 ++++++------ src/entrypoint.sh | 3 ++- src/gunicorn.conf.py | 10 ---------- 4 files changed, 9 insertions(+), 17 deletions(-) delete mode 100644 src/gunicorn.conf.py diff --git a/.gitignore b/.gitignore index 15d26b6..84831a4 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ spacedev_cache +dependencies diff --git a/Dockerfiles/Dockerfile b/Dockerfiles/Dockerfile index 40fed00..44c8f42 100755 --- a/Dockerfiles/Dockerfile +++ b/Dockerfiles/Dockerfile @@ -50,11 +50,12 @@ RUN python -m pip install \ RUN python -m pip install \ --no-warn-script-location \ --prefix=/pypi-server \ - . - -RUN mkdir -p /code/pypiserver-${PYPI_SERVER_VERSION}/docker/data/packages + twine -COPY src/gunicorn.conf.py /code/pypiserver-${PYPI_SERVER_VERSION}/docker/data/gunicorn.conf.py +RUN python -m pip install \ + --no-warn-script-location \ + --prefix=/pypi-server \ + . FROM mcr.microsoft.com/cbl-mariner/base/python:3.9 as final ARG OCI_REGISTRY_PORT=5000 @@ -84,12 +85,11 @@ COPY --from=downloader /htpasswd/libs/* /usr/lib/ # Copy the built pypi-server files COPY --from=pypi_builder /pypi-server /pypi-server -COPY --from=pypi_builder /code/pypiserver-${PYPI_SERVER_VERSION}/docker/data /data COPY --chmod=0755 src/entrypoint.sh /entrypoint.sh VOLUME "/var/lib/registry" -VOLUME "/data/packages" +VOLUME "/data" EXPOSE ${OCI_REGISTRY_PORT} ${PYPISERVER_PORT} USER root diff --git a/src/entrypoint.sh b/src/entrypoint.sh index 87c401a..f98668a 100644 --- a/src/entrypoint.sh +++ b/src/entrypoint.sh @@ -39,7 +39,8 @@ if [[ "${PYPISERVER_ENABLED}" == "true" ]]; then echo "PYPISERVER_ENABLED='true'. Starting the PyPiServer..." # Run the pypi server in the background mkdir -p /data/packages - /pypi-server/bin/pypi-server run -p ${PYPISERVER_PORT:-$PORT} --server gunicorn --backend cached-dir /data/packages --verbose --log-file /var/log/pypiserver.log & + export GUNICORN_CMD_ARGS="--accesslog - --errorlog - --preload --workers 1 --worker-class gevent" + /pypi-server/bin/pypi-server run -a . -P . -p ${PYPISERVER_PORT:-$PORT} --server gunicorn --backend cached-dir /data/packages --verbose --log-file /var/log/pypiserver.log & PYPI_PID=$! echo "...PyPiServer started." fi diff --git a/src/gunicorn.conf.py b/src/gunicorn.conf.py deleted file mode 100644 index 2253967..0000000 --- a/src/gunicorn.conf.py +++ /dev/null @@ -1,10 +0,0 @@ -# Enable to log every request -accesslog = "-" -errorlog = "-" -preload_app = True -workers = 1 -worker_class = "gevent" - -# SSL Certs -keyfile = "/certs/registry.spacefx.local.key" # Path to your private key file -certfile = "/certs/registry.spacefx.local.crt" # Path to your certificate file \ No newline at end of file