-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
1,437 additions
and
899 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,38 @@ | ||
FROM quay.io/cdis/python:python3.9-buster-2.0.0 as base | ||
ARG AZLINUX_BASE_VERSION=master | ||
|
||
FROM base as builder | ||
RUN pip install --upgrade pip poetry | ||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
build-essential gcc make musl-dev libffi-dev libssl-dev git curl bash | ||
# Base stage with python-build-base | ||
FROM quay.io/cdis/python-nginx-al:${AZLINUX_BASE_VERSION} AS base | ||
|
||
COPY . /src/ | ||
WORKDIR /src | ||
RUN python -m venv /env && . /env/bin/activate && poetry install --no-interaction --no-dev | ||
ENV appname=mds | ||
|
||
COPY --chown=gen3:gen3 /src/${appname} /${appname} | ||
|
||
WORKDIR /${appname} | ||
|
||
# Builder stage | ||
FROM base AS builder | ||
|
||
USER gen3 | ||
|
||
COPY poetry.lock pyproject.toml /${appname}/ | ||
|
||
# RUN python3 -m venv /env && . /env/bin/activate && | ||
RUN poetry install -vv --no-interaction --without dev | ||
|
||
COPY --chown=gen3:gen3 . /${appname} | ||
COPY --chown=gen3:gen3 ./deployment/wsgi/wsgi.py /${appname}/wsgi.py | ||
|
||
RUN poetry install -vv --no-interaction --without dev | ||
|
||
ENV PATH="$(poetry env info --path)/bin:$PATH" | ||
|
||
# Final stage | ||
FROM base | ||
COPY --from=builder /env /env | ||
COPY --from=builder /src /src | ||
ENV PATH="/env/bin/:${PATH}" | ||
WORKDIR /src | ||
CMD ["/env/bin/gunicorn", "mds.asgi:app", "-b", "0.0.0.0:80", "-k", "uvicorn.workers.UvicornWorker", "-c", "gunicorn.conf.py"] | ||
|
||
COPY --from=builder /${appname} /${appname} | ||
|
||
# Switch to non-root user 'gen3' for the serving process | ||
|
||
USER gen3 | ||
|
||
CMD ["/bin/bash", "-c", "/${appname}/dockerrun.bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from mds.main import get_app | ||
|
||
app = get_app() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
nginx | ||
poetry run gunicorn -c "/mds/deployment/wsgi/gunicorn.conf.py" mds.asgi:app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.