-
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.11@sha256:0ac957607303916420297a4c9c213bb33fbd3c888f9cd7f4f7273596ebf42b85 /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-1734497536@sha256:daa61d6103e98bccf40d7a69a0d4f8786ec390e2204fd94f7cc49053e9949360 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.11@sha256:0ac957607303916420297a4c9c213bb33fbd3c888f9cd7f4f7273596ebf42b85 /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