Skip to content

Commit 3624cc8

Browse files
authored
Merge pull request #329 from pbashyal-nmdp/docker-no-version
pyard-service Docker changes
2 parents 2c570be + 2c95a0d commit 3624cc8

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

Dockerfile

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,9 @@ RUN pip install --no-cache-dir -r requirements-deploy.txt
1515

1616
RUN pip install --no-cache-dir py-ard==$PY_ARD_VERSION
1717

18-
RUN pyard-import && \
19-
pyard --version && \
20-
pyard-status
21-
2218
COPY app.py /app/
2319
COPY api.py /app/
2420
COPY api-spec.yaml /app/
2521

26-
CMD ["gunicorn", "--bind", "0.0.0.0:8080", "--worker-tmp-dir", "/dev/shm", "--timeout", "30", "app:app"]
22+
COPY docker-entrypoint-flask.sh /usr/local/bin/
23+
CMD ["/usr/local/bin/docker-entrypoint-flask.sh"]

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
PROJECT_NAME := $(shell basename `pwd`)
22
PACKAGE_NAME := pyard
3+
PYARD_VERSION := 1.2.1
34

45
.PHONY: clean clean-test clean-pyc clean-build docs help
56
.DEFAULT_GOAL := help
@@ -98,10 +99,11 @@ dist: clean ## builds source and wheel package
9899
ls -l dist
99100

100101
docker-build: ## build a docker image for the service
101-
docker build --platform=linux/amd64 -t nmdpbioinformatics/pyard-service:latest .
102+
docker build --platform=linux/amd64 -t nmdpbioinformatics/pyard-service:$(PYARD_VERSION).linux-amd64 .
103+
docker tag nmdpbioinformatics/pyard-service:$(PYARD_VERSION) nmdpbioinformatics/pyard-service:latest
102104

103105
docker: docker-build ## build a docker image and run the service
104-
docker run --platform=linux/amd64 --rm --name pyard-service -p 8080:8080 nmdpbioinformatics/pyard-service:latest
106+
docker run --platform=linux/amd64 --rm --name pyard-service -p 8080:8080 nmdpbioinformatics/pyard-service:$(PYARD_VERSION).linux-amd64
105107

106108
install: clean ## install the package to the active Python's site-packages
107109
pip install --upgrade pip

docker-entrypoint-flask.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
set -e
3+
4+
# A positive integer generally in the 2-4 x $(NUM_CORES) range.
5+
WORKER_PROCESSES=${WORKERS:-4}
6+
7+
echo "Starting py-ard service with" "${WORKER_PROCESSES}" worker processes.
8+
9+
if [ "${WORKER_PROCESSES}" != "1" ]; then
10+
WORKER_FLAG="--workers=${WORKER_PROCESSES}"
11+
fi
12+
13+
# Import the latest pyard before starting the app
14+
pyard-import
15+
16+
gunicorn --preload --bind 0.0.0.0:8080 --timeout 5000 --log-level info "${WORKER_FLAG}" app:app

0 commit comments

Comments
 (0)