Browse Source

Use Alpine docker image; do not start coilmq.

Stefano Cossu 5 years ago
parent
commit
a552ff7405
3 changed files with 30 additions and 16 deletions
  1. 27 13
      Dockerfile
  2. 2 2
      docker/etc/application.yml
  3. 1 1
      lakesuperior/wsgi.py

+ 27 - 13
Dockerfile

@@ -1,15 +1,29 @@
-FROM        python:3.7
-MAINTAINER  Michael B. Klein <michael.klein@northwestern.edu>
-RUN         mkdir -p /usr/local /data
-WORKDIR     /usr/local
-ADD         . lakesuperior
-WORKDIR     /usr/local/lakesuperior
-RUN         git submodule update --init
-RUN         [[ -f lakesuperior/model/base.c ]] || \
-                pip install -r requirements_dev.txt
+FROM        python:3.7-alpine
+LABEL       "maintainer"="Michael B. Klein <michael.klein@northwestern.edu>" \
+            "maintainer"="Stefano Cossu <scossu@getty.edu>"
+
+RUN         apk add --no-cache build-base
+RUN         apk add git
+RUN         pip3 install cython==0.29.6 cymem
+
+RUN         mkdir -p /data
+WORKDIR     /usr/local/lsup/src
+COPY        .git ./.git
+COPY        ext ./ext
+COPY        lakesuperior ./lakesuperior
+COPY        setup.py README.rst ./
+
+RUN         git submodule update --init ext
 RUN         pip install -e .
-RUN         cp ./docker/etc/* ./lakesuperior/etc.defaults/
-CMD         ./docker/docker_entrypoint
+COPY        ./docker/etc ./lakesuperior/etc.defaults
+
+RUN         [ -f /data/ldprs_store/data.mdb ] || \
+                echo yes | lsup-admin bootstrap
+
+VOLUME      /data
+
 EXPOSE      8000
-HEALTHCHECK --interval=30s --timeout=5s \
-  CMD curl -X OPTIONS -f http://localhost:8000/ || exit 1
+
+ENTRYPOINT  ["gunicorn", "-c", "python:lakesuperior.wsgi", \
+            "lakesuperior.server:fcrepo"]
+#ENTRYPOINT  ["/bin/sh"]

+ 2 - 2
docker/etc/application.yml

@@ -10,7 +10,7 @@
 #   One of ``prod``, ``test`` or ``dev``.
 #   ``prod`` is normal running mode. 'test' is used for running test suites.
 #   ``dev`` is similar to normal mode but with reload and debug enabled.
-app_mode: 'dev'
+app_mode: 'prod'
 
 ###
 #   Base data directory.
@@ -23,7 +23,7 @@ app_mode: 'dev'
 #   the individual subdirectories can be mounted on different file systems.
 #
 #   If unset, it will default to <lakesuperior package root>/data.
-data_dir:
+data_dir: /data
 
 ###
 # Configuration for binary path and fixity check generation. The hash is a

+ 1 - 1
lakesuperior/wsgi.py

@@ -89,7 +89,7 @@ group = __def.config.get('group')
 raw_env = 'APP_MODE={}'.format(__app_mode)
 
 preload_app = __def.config.get('preload_app', __def.preload_app)
-daemon = __app_mode == 'prod'
+#daemon = __app_mode == 'prod'
 reload = __app_mode == 'dev' and not preload_app
 
 pidfile = os.path.join(__def.run_dir, 'fcrepo.pid')