File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3636 reverse_proxy 127.0.0.1:8000
3737 }
3838
39+ @sourcemaps path *.map
40+ handle @sourcemaps {
41+ @maps_allowed expression `{env.SERVE_SOURCE_MAPS} == "true"`
42+ handle @maps_allowed {
43+ root * /srv/ui
44+ file_server
45+ }
46+ handle {
47+ respond "Not Found" 404
48+ }
49+ }
50+
3951 handle {
4052 root * /srv/ui
4153 try_files {path} /index.html
Original file line number Diff line number Diff line change @@ -53,7 +53,12 @@ RUN uv venv --python $(which python3) $UV_PROJECT_DIRECTORY \
5353FROM caddy:${CADDY_VERSION} AS caddy
5454
5555# ---------------------------------------------------------------------------
56- # Stage 4: Final runtime image
56+ # Stage 4: Sentry CLI binary
57+ # ---------------------------------------------------------------------------
58+ FROM getsentry/sentry-cli AS sentry-cli
59+
60+ # ---------------------------------------------------------------------------
61+ # Stage 5: Final runtime image
5762# ---------------------------------------------------------------------------
5863FROM python:${PYTHON_VERSION}-slim AS runtime
5964
@@ -71,6 +76,9 @@ COPY --from=python-builder --chown=imbi:users /app/ /app/
7176# Copy Caddy binary
7277COPY --from=caddy /usr/bin/caddy /usr/local/bin/caddy
7378
79+ # Copy Sentry CLI binary
80+ COPY --from=sentry-cli /bin/sentry-cli /usr/local/bin/sentry-cli
81+
7482# Copy Caddyfile
7583COPY Caddyfile /etc/caddy/Caddyfile
7684
Original file line number Diff line number Diff line change 9797
9898check_errors " service '$IMBI_SERVICE '"
9999
100+ # --------------------------------------------------------------------------
101+ # Optional: upload source maps to Sentry
102+ # --------------------------------------------------------------------------
103+ # Runs when SENTRY_AUTH_TOKEN, SENTRY_ORG, and SENTRY_PROJECT are all set.
104+ # SENTRY_RELEASE defaults to unversioned if not provided.
105+ # Maps remain in the image; whether they are served is controlled by
106+ # the SERVE_SOURCE_MAPS env var (Caddy returns 404 unless it is "true").
107+
108+ upload_sourcemaps () {
109+ if [ -z " ${SENTRY_AUTH_TOKEN:- } " ] || \
110+ [ -z " ${SENTRY_ORG:- } " ] || \
111+ [ -z " ${SENTRY_PROJECT:- } " ]; then
112+ return
113+ fi
114+ echo " Uploading source maps to Sentry..."
115+ local args=" --org $SENTRY_ORG --project $SENTRY_PROJECT "
116+ if [ -n " ${SENTRY_RELEASE:- } " ]; then
117+ args=" $args --release $SENTRY_RELEASE "
118+ fi
119+ if [ -n " ${SENTRY_URL:- } " ]; then
120+ args=" $args --url $SENTRY_URL "
121+ fi
122+ sentry-cli sourcemaps upload $args /srv/ui/assets/
123+ echo " Source maps uploaded."
124+ }
125+
126+ upload_sourcemaps
127+
100128# --------------------------------------------------------------------------
101129# Service startup
102130# --------------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments