-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathDockerfile
79 lines (62 loc) · 1.95 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#
# Upstream image (Glitchtip version)
#
ARG GLITCHTIP_VERSION=v4.1.5
ARG GLITCHTIP_IMAGE=registry.gitlab.com/glitchtip/glitchtip-frontend:${GLITCHTIP_VERSION}
FROM ${GLITCHTIP_IMAGE} AS upstream
#
# Base image
#
FROM registry.access.redhat.com/ubi9/python-312:9.5-1736338296@sha256:9b84a91c94aa7e7ebfcd416db7857610bc7872ba6170cfa7b0753590d4b71dd0 AS base
COPY --from=upstream /code/LICENSE /licenses/LICENSE
ARG GLITCHTIP_VERSION
ENV GLITCHTIP_VERSION=${GLITCHTIP_VERSION}
LABEL konflux.additional-tags="${GLITCHTIP_VERSION}"
#
# Build and patch Glitchtip
#
FROM base AS builder
ENV \
# use venv from ubi image
UV_PROJECT_ENVIRONMENT=$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 --from=ghcr.io/astral-sh/uv:0.5.25@sha256:a73176b27709bff700a1e3af498981f31a83f27552116f21ae8371445f0be710 /uv /bin/uv
COPY --from=upstream --chown=1001:root /code ./
# Install the required packages
RUN uv sync --frozen --no-group dev
# Our customizations
COPY bin/* ./bin/
COPY appsre ./appsre
# Apply our patches
COPY patches ./patches
# Do not send invitation emails
RUN cat patches/00-skip-user-invitation-process.patch | patch -p1
# add https:// to the s3 endpoint url
RUN cat patches/04-aws-s3-endpoint-url.patch | patch -p1
#
# Final image
#
FROM base AS prod
ENV PORT=8080
EXPOSE ${PORT}
# get everything from the builder
COPY --from=builder $APP_ROOT/ $APP_ROOT/
# Collect static files
RUN SECRET_KEY=ci ./manage.py collectstatic --noinput
CMD ["./bin/start.sh"]
#
# Test image
#
FROM prod AS test
COPY --from=ghcr.io/astral-sh/uv:0.5.25@sha256:a73176b27709bff700a1e3af498981f31a83f27552116f21ae8371445f0be710 /uv /bin/uv
ENV \
# use venv from ubi image
UV_PROJECT_ENVIRONMENT=$APP_ROOT \
# disable uv cache. it doesn't make sense in a container
UV_NO_CACHE=true
COPY Makefile pyproject.toml ./
COPY acceptance/ ./acceptance/
RUN make test