-
Notifications
You must be signed in to change notification settings - Fork 20
/
Dockerfile
44 lines (37 loc) · 1.11 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
##############
# base stage #
##############
FROM registry.access.redhat.com/ubi9/python-312@sha256:88ea2d10c741f169681102b46b16c66d20c94c3cc561edbb6444b0de3a1c81b3 AS base
COPY LICENSE /licenses/LICENSE
#################
# builder stage #
#################
FROM base AS builder
COPY --from=ghcr.io/astral-sh/uv:0.5.7@sha256:23272999edd22e78195509ea3fe380e7632ab39a4c69a340bedaba7555abe20a /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
COPY pyproject.toml uv.lock ./
# Test lock file is up to date
RUN uv lock --locked
# Install the project dependencies
RUN uv sync --frozen --no-install-project --no-group dev
COPY README.md ./
COPY validator ./validator
RUN uv sync --frozen --no-group dev
##############
# test stage #
##############
FROM builder AS test
COPY Makefile ./
RUN uv sync --frozen
RUN make _test
##############
# prod stage #
##############
FROM base AS prod
COPY --from=builder /opt/app-root /opt/app-root