Skip to content

Commit

Permalink
test it out with src mounted
Browse files Browse the repository at this point in the history
  • Loading branch information
jweede committed Nov 29, 2017
1 parent ae719ae commit 103faca
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ VENV := venv

DOCKER_IMAGE_NAME ?= shoobx/keas.kmi
KMI_VERSION ?= $(shell python setup.py --version)
DOCKER_TAG := $(DOCKER_IMAGE_NAME):$(KMI_VERSION)
export DOCKER_TAG := $(DOCKER_IMAGE_NAME):$(KMI_VERSION)

.PHONY: all # default target builds kmi locally
all: bin/kmi
Expand All @@ -25,6 +25,10 @@ docker:
docker-publish: docker
docker push "$(DOCKER_TAG)"

.PHONY: docker-run # quick example of running this
docker-run: docker keys/
bash docker/run_dev.sh

bin/kmi: bin/buildout
$(VENV)/bin/pip install 'setuptools<38.2'
bin/buildout
Expand All @@ -34,3 +38,6 @@ bin/buildout: venv/bin/python

ve/ venv/bin/python venv/bin/pip:
virtualenv -p python2 $(VENV)/

keys/:
mkdir -p "$@"
2 changes: 1 addition & 1 deletion docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ assert p.read(['versions.cfg'])
requirements = (
"{0}=={1}".format(name, version)
for name, version in p.items('versions')
if not re.search(r'\.recipe\.|buildout', name)
if not re.search(r'\.recipe\.|buildout|\.testing', name)
)
for version_string in requirements:
Expand Down
1 change: 1 addition & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ ZOPE

# resume entrypoint stuff
if [[ "${1:-}" == 'run' ]]; then
ls keys/
gunicorn --paste "${GENERATED_SERV_CONF_FILE}"
else
exec "$@"
Expand Down
10 changes: 10 additions & 0 deletions docker/run_dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -eux
HERE="$(dirname $(realpath "$0"))"
PROJECT_DIR="$(realpath "${HERE}/../")"
DOCKER_TAG="${DOCKER_TAG:-shoobx/keas.kmi:$(python setup.py --version)}"

exec docker run -it -p 8080:8080 --rm --name=keas.kmi \
--mount "type=bind,source=${PROJECT_DIR}/src/keas,target=/opt/keas.kmi/src/keas" \
--mount "type=bind,source=${PROJECT_DIR}/keys,target=/opt/keas.kmi/keys" \
"${DOCKER_TAG}" "$@"

0 comments on commit 103faca

Please sign in to comment.