Skip to content

Commit

Permalink
using poetry as virtual environment
Browse files Browse the repository at this point in the history
  • Loading branch information
EliseCastle23 committed Nov 1, 2024
1 parent ab30f7f commit 6cc4757
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ ARG AZLINUX_BASE_VERSION=master
# Base stage with python-build-base
FROM quay.io/cdis/python-nginx-al:${AZLINUX_BASE_VERSION} AS base

# FROM 707767160287.dkr.ecr.us-east-1.amazonaws.com/gen3/python-build-base:${AZLINUX_BASE_VERSION} as base

ENV appname=mds

COPY --chown=gen3:gen3 /src/${appname} /${appname}
Expand All @@ -14,20 +12,19 @@ WORKDIR /${appname}
# Builder stage
FROM base AS builder

RUN mkdir /env && \
chown -R gen3:gen3 /env

USER gen3

COPY poetry.lock pyproject.toml /${appname}/

RUN python3 -m venv /env && . /env/bin/activate && poetry install -vv --no-interaction --without dev
# 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 again so this app itself gets installed too
RUN python3 -m venv /env && . /env/bin/activate && poetry install -vv --no-interaction --without dev
RUN poetry install -vv --no-interaction --without dev

ENV PATH="$(poetry env info --path)/bin:$PATH"

# Final stage
FROM base
Expand All @@ -39,9 +36,4 @@ COPY --from=builder /${appname} /${appname}

USER gen3

RUN source /env/bin/activate

# Add /env/bin to PATH
ENV PATH="/env/bin:$PATH"

CMD ["/bin/bash", "-c", "/${appname}/dockerrun.bash"]

0 comments on commit 6cc4757

Please sign in to comment.