-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
90 lines (72 loc) · 3.4 KB
/
Dockerfile
File metadata and controls
90 lines (72 loc) · 3.4 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
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
80
81
82
83
84
85
86
87
88
89
############################
# Builder: Next.js + Python
############################
FROM alpine AS builder
# Build arguments for configurable versions
ARG OTEL_VERSION=v0.132.4
ARG OPAMP_SUPERVISOR_VERSION=v0.132.4
ARG TARGETARCH
# Install build dependencies
# Note: || true handles QEMU emulation trigger errors in cross-platform builds
RUN apk add --no-cache nodejs npm python3 py3-pip pipx rust cargo build-base || true
# Create virtual environment for runtime Python deps
RUN python3 -m venv /app/client/venv
RUN /app/client/venv/bin/pip install --no-cache-dir litellm && \
find /app/client/venv -name '*.pyc' -delete && \
find /app/client/venv -name '__pycache__' -type d -exec rm -r {} +
# Build the Next.js client
WORKDIR /app/client
COPY ./src/client/ .
RUN npm install && npm run build
############################
# Builder: OpAMP server
############################
FROM golang:1.25-alpine AS go-builder
WORKDIR /app/opamp-server
RUN apk add --no-cache git || true
COPY ./src/opamp-server/ ./
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o opamp-server .
#################################
# Downloader: Otel + Supervisor
#################################
FROM alpine AS otel-downloader
ARG OTEL_VERSION=v0.132.4
ARG OPAMP_SUPERVISOR_VERSION=v0.132.4
ARG TARGETARCH
RUN apk add --no-cache curl || true
WORKDIR /tmp
RUN curl -LO "https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/${OTEL_VERSION}/otelcol-contrib_${OTEL_VERSION#v}_linux_${TARGETARCH}.tar.gz" && \
tar -xzf "otelcol-contrib_${OTEL_VERSION#v}_linux_${TARGETARCH}.tar.gz" && \
chmod +x otelcol-contrib
RUN curl --proto '=https' --tlsv1.2 -fL -o opampsupervisor \
"https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/cmd%2Fopampsupervisor%2F${OPAMP_SUPERVISOR_VERSION}/opampsupervisor_${OPAMP_SUPERVISOR_VERSION#v}_linux_${TARGETARCH}" && \
chmod +x opampsupervisor
############################
# Runtime image
############################
FROM alpine
ARG DOCKER_PORT=3000
RUN apk add --no-cache nodejs bash openssl python3 || true
WORKDIR /app/client
# Python runtime (for litellm-backed features)
COPY --from=builder /app/client/venv ./venv
# Next.js standalone output
COPY --from=builder /app/client/.next/standalone ./
COPY --from=builder /app/client/public ./public
COPY --from=builder /app/client/.next/static ./.next/static
COPY --from=builder /app/client/prisma ./prisma
COPY --from=builder /app/client/scripts ./scripts
COPY --from=builder /app/client/node_modules/@prisma ./node_modules/@prisma
COPY --from=builder /app/client/node_modules/.bin ./node_modules/.bin
COPY --from=builder /app/client/node_modules/prisma ./node_modules/prisma
# OpAMP binaries and supporting assets
COPY --from=go-builder /app/opamp-server/opamp-server /app/opamp/opamp-server
COPY --from=go-builder /app/opamp-server/certs /app/opamp/certs
COPY --from=go-builder /app/opamp-server/setup-supervisor.sh /app/opamp/setup-supervisor.sh
COPY --from=otel-downloader /tmp/otelcol-contrib /app/opamp/otelcontribcol
COPY --from=otel-downloader /tmp/opampsupervisor /app/opamp/opampsupervisor
RUN chmod +x ./scripts/entrypoint.sh /app/opamp/otelcontribcol /app/opamp/opampsupervisor /app/opamp/opamp-server /app/opamp/setup-supervisor.sh && \
chmod -R u=rwX,go= /app/opamp/certs
EXPOSE ${DOCKER_PORT}
# Entrypoint starts Next.js and supporting services
CMD ["/app/client/scripts/entrypoint.sh"]