-
Notifications
You must be signed in to change notification settings - Fork 28
/
Dockerfile
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.9@sha256:ba36ea627a75e2a879b7f36efe01db5a24038f8d577bd7214a6c99d5d4f4b20c /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-1733767867@sha256:dee813b83663d420eb108983a1c94c614ff5d3fcb5159a7bd0324f0edbe7fca1 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.9@sha256:ba36ea627a75e2a879b7f36efe01db5a24038f8d577bd7214a6c99d5d4f4b20c /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