-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathContainerfile
39 lines (31 loc) · 1.2 KB
/
Containerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
ARG PYTHON_VERSION="3.12"
ARG BASE_IMAGE="docker.io/python:${PYTHON_VERSION}-alpine"
FROM ${BASE_IMAGE} AS poetry
RUN apk add --no-cache \
build-base \
libffi-dev
ARG POETRY_VERSION="1.8.3"
RUN pip install poetry==${POETRY_VERSION}
FROM poetry AS builder
WORKDIR /src
COPY poetry.lock pyproject.toml README.md LICENSE ./
RUN python -m venv /app && \
source /app/bin/activate && \
poetry install --only main --no-root
ARG POETRY_DYNAMIC_VERSIONING_VERSION="1.4.1"
RUN poetry self add "poetry-dynamic-versioning[plugin]==${POETRY_DYNAMIC_VERSIONING_VERSION}"
RUN apk add --no-cache git
COPY tsdapiclient ./tsdapiclient
COPY .git ./.git
RUN source /app/bin/activate && \
poetry build --format wheel --no-interaction && \
pip install dist/*.whl
FROM ${BASE_IMAGE} AS runtime
LABEL org.opencontainers.image.title="TSD API Client" \
org.opencontainers.image.description="Command line client for the TSD HTTP API" \
org.opencontainers.image.url="https://github.com/unioslo/tsd-api-client" \
org.opencontainers.image.source="https://github.com/unioslo/tsd-api-client"
ENTRYPOINT [ "/app/bin/tacl" ]
ENV XDG_CONFIG_HOME=/config
VOLUME [ "/config/tacl" ]
COPY --from=builder /app /app