From 2db7a2952564710346499ef85e689a7b3ce17a68 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 18 Jul 2014 13:46:05 -0700 Subject: [PATCH] docker-registry/Dockerfile.template: Launch with 'exec docker-registry' And modernize the installation and execution: * Remove setup-configs.sh call, because the script is gone since 2ee1387a (Clean up configuration management, 2014-05-08). * Use the setup.py-installed docker-registry endpoint, because run.sh is gone since bf3360a2 (replacing run.sh with a "docker-registry" console script, 2014-04-02). Unfortunately, I can't find a way to run docker-registry from the source directory (without installing it), because Setuptools' pkg_resources seems to need some namespace-package *.pth funkyness. Luckily all this is easier with the PEP 420 namespace implementation that landed in Python 3.3. * Don't pass '--preload' to Gunicorn, because docker_registry.run is loading bulk of docker_registry before launching the Gunicorn process. The stack pulling in the initial database-setup is: File "/.../docker_registry/run.py", line 23, in from .search import * # noqa File "/.../docker_registry/search.py", line 17, in INDEX = index.load(cfg.search_backend.lower()) File "/.../docker_registry/lib/index/__init__.py", line 82, in load return db.SQLAlchemyIndex() ... It seems inefficient to drag all this into the Gunicorn process for folks that don't need single-threaded setup, but whatever, it works for my use case ;). --- docker-registry/Dockerfile.template | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docker-registry/Dockerfile.template b/docker-registry/Dockerfile.template index 5efbe43..cbb3788 100644 --- a/docker-registry/Dockerfile.template +++ b/docker-registry/Dockerfile.template @@ -35,5 +35,11 @@ RUN eselect news read new RUN git clone git://github.com/dotcloud/docker-registry.git RUN cp --no-clobber docker-registry/config/config_sample.yml docker-registry/config/config.yml -CMD cd docker-registry && ./setup-configs.sh && ./run.sh --preload +# Disable strict dependencies (see dotcloud/docker-registry#466) +RUN sed -i 's/\(install_requires=\)/#\1/' docker-registry/setup.py docker-registry/depends/docker-registry-core/setup.py + +RUN cd docker-registry/depends/docker-registry-core/ && python setup.py install +RUN cd docker-registry && python setup.py install + +CMD exec docker-registry EXPOSE 5000 -- 2.26.2