Skip to content

Commit

Permalink
Convert to pyproject setup
Browse files Browse the repository at this point in the history
  • Loading branch information
nikdoof committed Nov 1, 2023
1 parent 4b98aa1 commit 8f4028e
Show file tree
Hide file tree
Showing 4 changed files with 488 additions and 8 deletions.
35 changes: 30 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,33 @@
FROM python:3.11.5-alpine3.18
FROM python:3.11.5-alpine3.18 AS base

WORKDIR /code
COPY ./requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
COPY ./gocardless_membership_exporter /code/gocardless_membership_exporter
FROM base AS builder

ENV PYTHONFAULTHANDLER=1 \
PYTHONUNBUFFERED=1 \
PYTHONHASHSEED=random \
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_CREATE=false \
PATH="$PATH:/runtime/bin" \
PYTHONPATH="$PYTHONPATH:/runtime/lib/python3.11/site-packages" \
# Versions:
POETRY_VERSION=1.5.1

# System deps:
RUN apk add build-base unzip wget python3-dev libffi-dev
RUN pip install "poetry==$POETRY_VERSION"

WORKDIR /src

# Generate requirements and install *all* dependencies.
COPY pyproject.toml poetry.lock /src/
RUN poetry export --dev --without-hashes --no-interaction --no-ansi -f requirements.txt -o requirements.txt
RUN pip install --prefix=/runtime --force-reinstall -r requirements.txt

FROM base AS runtime
COPY --from=builder /runtime /usr/local
COPY ./gocardless_membership_exporter /app/gocardless_membership_exporter
WORKDIR /app
CMD ["python", "-m", "gocardless_membership_exporter"]
Loading

0 comments on commit 8f4028e

Please sign in to comment.