Repository navigation
Expand file tree
/
Copy pathDockerfile.web
More file actions
41 lines (39 loc) · 1.72 KB
/
Copy pathDockerfile.web
File metadata and controls
41 lines (39 loc) · 1.72 KB
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
# CoreScope web container: the static UI on its own, served by Caddy, which
# forwards /api and /ws to a CoreScope server container. The UI and the API
# then share one origin, so the server needs no CORS settings. Logins work as
# on the classic UI once the server's userManagement.publicBaseUrl is this
# container's public origin. docker-compose.split.yml runs the two together;
# see "Deployment modes" in docs/deployment.md.
#
# Runtime environment:
# BACKEND host:port of the CoreScope server. Default corescope:3000.
# SITE_ADDRESS :80 (default) for plain HTTP, or a domain name for Caddy's
# automatic HTTPS (publish 80 and 443, and keep /data).
FROM alpine:3.24 AS build
RUN apk add --no-cache bash
WORKDIR /src
COPY public/ public/
COPY scripts/static/ scripts/static/
COPY deploy/static/ deploy/static/
# GIT_COMMIT is the cache buster on every asset (?v=); without one, the build
# time, as the server does at start. CHANNEL beta, next or dev shows a badge.
# CORESCOPE_URL is the public URL for link previews (og:url, og:image); a
# static image cannot read it from requests, so without one og:url is left out.
ARG GIT_COMMIT=
ARG CHANNEL=static
ARG CORESCOPE_URL=
RUN COMMIT="$(printf '%.12s' "${GIT_COMMIT:-$(date +%s)}")" \
API_BASE=same-origin AUTH=true CHANNEL="$CHANNEL" CORESCOPE_URL="$CORESCOPE_URL" OUT=/srv \
bash scripts/static/build.sh && \
rm /srv/_headers
FROM alpine:3.24
RUN apk add --no-cache caddy
COPY --from=build /srv /srv
COPY docker/web/Caddyfile /etc/caddy/Caddyfile
ENV BACKEND=corescope:3000 \
SITE_ADDRESS=:80 \
XDG_DATA_HOME=/data \
XDG_CONFIG_HOME=/config
EXPOSE 80 443
VOLUME ["/data"]
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"]