-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (41 loc) · 1.76 KB
/
Copy pathDockerfile
File metadata and controls
51 lines (41 loc) · 1.76 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
42
43
44
45
46
47
48
49
50
51
# examples/simple-html/Dockerfile
#
# Zero build-step example — a single HTML file served by the REP gateway
# in embedded mode. The SDK is loaded via esm.sh at runtime.
#
# Build:
# docker build -t rep-simple-html .
#
# Run:
# docker run --rm -p 8080:8080 \
# -e REP_PUBLIC_APP_TITLE="My App" \
# -e REP_PUBLIC_API_URL=https://api.example.com \
# -e REP_PUBLIC_ENV_NAME=production \
# -e REP_PUBLIC_FEATURE_FLAGS=dark-mode,beta \
# -e REP_SENSITIVE_ANALYTICS_KEY=ak_live_abc123 \
# rep-simple-html
# ── Stage 1: Download pre-built REP Gateway binary ────────────────────────────
FROM alpine:3.21 AS gateway
ARG GATEWAY_VERSION=0.1.3
ARG TARGETARCH=amd64
RUN apk add --no-cache curl ca-certificates && \
ARCHIVE="rep-gateway_${GATEWAY_VERSION}_linux_${TARGETARCH}.tar.gz" && \
curl -fsSL \
"https://github.com/RuachTech/rep/releases/download/gateway/v${GATEWAY_VERSION}/${ARCHIVE}" \
-o /tmp/gateway.tar.gz && \
tar -xzf /tmp/gateway.tar.gz -C /tmp && \
mv /tmp/rep-gateway /rep-gateway && \
chmod +x /rep-gateway
# ── Stage 2: Minimal runtime image (FROM scratch) ──────────────────────────────
FROM scratch
# Gateway binary
COPY --from=gateway /rep-gateway /rep-gateway
# Static HTML file — the only "app" artefact
COPY index.html /static/index.html
# CA certificates for esm.sh and /rep/session-key HTTPS calls from the browser
COPY --from=gateway /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
# Non-root user (nobody)
USER 65534:65534
EXPOSE 8080
# Embedded mode: gateway serves /static directly, no upstream needed
ENTRYPOINT ["/rep-gateway", "--mode", "embedded", "--static-dir", "/static"]