-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathDockerfile
34 lines (31 loc) · 1.56 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
FROM registry.access.redhat.com/ubi9/python-311:1-1733172699@sha256:3d9ce0a19b0edc6f7a60a933ea9e53a809282972fde30003ce686437affde070 AS builder
COPY --from=ghcr.io/astral-sh/uv:0.5.25@sha256:a73176b27709bff700a1e3af498981f31a83f27552116f21ae8371445f0be710 /uv /bin/uv
WORKDIR /ghmirror
COPY --chown=1001:0 pyproject.toml uv.lock ./
RUN uv lock --locked
COPY --chown=1001:0 ghmirror ./ghmirror
RUN uv sync --frozen --no-cache --compile-bytecode --no-group dev --python /usr/bin/python3.11
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.5-1736404155@sha256:b87097994ed62fbf1de70bc75debe8dacf3ea6e00dd577d74503ef66452c59d6 AS prod
RUN microdnf upgrade -y && \
microdnf install -y python3.11 && \
microdnf clean all
COPY LICENSE /licenses/LICENSE
WORKDIR /ghmirror
RUN chown -R 1001:0 /ghmirror
USER 1001
ENV VIRTUAL_ENV=/ghmirror/.venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
COPY --from=builder /ghmirror /ghmirror
COPY acceptance ./acceptance
ENTRYPOINT ["gunicorn", "ghmirror.app:APP"]
CMD ["--workers", "1", "--threads", "8", "--bind", "0.0.0.0:8080"]
FROM prod AS test
COPY --from=ghcr.io/astral-sh/uv:0.5.25@sha256:a73176b27709bff700a1e3af498981f31a83f27552116f21ae8371445f0be710 /uv /bin/uv
USER root
RUN microdnf install -y make
USER 1001
COPY --chown=1001:0 Makefile ./
COPY --chown=1001:0 tests ./tests
ENV UV_NO_CACHE=true
RUN uv sync --frozen
RUN make check