Created
December 21, 2021 16:09
-
-
Save jjuarez/44d8d752f94c9e68e2a7f3637ab16ed3 to your computer and use it in GitHub Desktop.
Dockerfile using python poetry
This file contains hidden or 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
ARG IMAGE_TAG="3.8.12-alpine3.15@sha256:ae21a996ebe902ddc73cff020202d94cb539c8c4426f67636374b32a6f9c3d22" | |
FROM python:${IMAGE_TAG} AS builder | |
ARG POETRY_VERSION=1.1.12 | |
# hadolint ignore=DL3013,DL3018 | |
RUN apk add --no-cache \ | |
gcc \ | |
libffi-dev \ | |
musl-dev && \ | |
pip install --no-cache-dir --upgrade pip && \ | |
pip install --no-cache-dir poetry==${POETRY_VERSION} | |
WORKDIR /build | |
COPY . ./ | |
RUN poetry config virtualenvs.create false && \ | |
poetry build | |
FROM python:${IMAGE_TAG} AS runtime | |
ARG PACKAGE_NAME_PATTERN="ssh_tunnel-*-py3-none-any.whl" | |
COPY --from=builder /build/dist/*.whl /tmp/ | |
# hadolint ignore=DL3013 | |
RUN apk add --no-cache bash=5.1.8-r0 && \ | |
pip install --no-cache-dir --upgrade pip && \ | |
pip install --no-cache-dir /tmp/${PACKAGE_NAME_PATTERN} && \ | |
rm -f /tmp/${PACKAGE_NAME_PATTERN} | |
CMD [ "/bin/bash" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment