Skip to content

Commit

Permalink
Merge pull request #109 from scossu/docker
Browse files Browse the repository at this point in the history
Docker
  • Loading branch information
scossu committed Jun 29, 2019
2 parents 7c57b95 + 20d9102 commit d453cc0
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 29 deletions.
44 changes: 31 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,33 @@
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 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 bin ./bin
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

# Clean up build-required packages & dirs.
RUN apk del build-base git
RUN rm -rf .git

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/fcrepo"]
2 changes: 1 addition & 1 deletion bin/fcrepo
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash
#!/bin/sh

gunicorn -c python:lakesuperior.wsgi lakesuperior.server:fcrepo
5 changes: 3 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
version: '2'
version: '3'

volumes:
lakesuperior:

services:
lakesuperior:
image: scossu/lakesuperior:stable
build:
context: .
volumes:
- lakesuperior:/data
ports:
Expand Down
10 changes: 0 additions & 10 deletions docker/docker_entrypoint

This file was deleted.

4 changes: 2 additions & 2 deletions docker/etc/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lakesuperior/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def __init__(self):
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')
Expand Down

0 comments on commit d453cc0

Please sign in to comment.