-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDockerfile
46 lines (35 loc) · 1.04 KB
/
Dockerfile
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
40
41
42
43
44
45
46
FROM registry.access.redhat.com/ubi9/python-311@sha256:881c23ee1508391d894f1688dbe51ec0ea193df0151a5c9a91c21c439d311527 AS base
# er-outputs-secrets version. keep in sync with pyproject.toml
LABEL konflux.additional-tags="0.2.2"
COPY LICENSE /licenses/
#
# Builder image
#
FROM base AS builder
COPY --from=ghcr.io/astral-sh/uv:0.6.3@sha256:8257f3d17fd04794feaf89d83b4ccca3b2eaa5501de9399fa53929843c0a5b55 /uv /bin/uv
ENV \
# use venv from ubi image
UV_PROJECT_ENVIRONMENT="/opt/app-root" \
# compile bytecode for faster startup
UV_COMPILE_BYTECODE="true" \
# disable uv cache. it doesn't make sense in a container
UV_NO_CACHE=true
# Install dependencies
COPY pyproject.toml uv.lock ./
RUN uv sync --frozen --no-install-project --no-group dev
COPY main.py ./
RUN uv sync --frozen --no-group dev
#
# Test image
#
FROM builder AS test
COPY Makefile ./
RUN uv sync --frozen
COPY tests ./tests
RUN make test
#
# Production image
#
FROM base AS prod
COPY --from=builder /opt/app-root /opt/app-root
ENTRYPOINT [ "python3", "main.py" ]