-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
67 lines (54 loc) · 2.29 KB
/
Copy pathDockerfile
File metadata and controls
67 lines (54 loc) · 2.29 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
# syntax=docker/dockerfile:1
# Multi-stage build — Node frontend first, then CGo Go build.
ARG CLOUDFLARED_VERSION=2024.11.1
##############################################################################
# cloudflared binary (multi-arch: TARGETARCH = amd64 | arm64)
##############################################################################
FROM debian:bookworm-slim AS cloudflared-dl
ARG TARGETARCH
ARG CLOUDFLARED_VERSION
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates curl \
&& rm -rf /var/lib/apt/lists/*
RUN curl -fsSL \
"https://github.com/cloudflare/cloudflared/releases/download/${CLOUDFLARED_VERSION}/cloudflared-linux-${TARGETARCH}" \
-o /usr/local/bin/cloudflared \
&& chmod +x /usr/local/bin/cloudflared
##############################################################################
# Frontend build
##############################################################################
FROM node:22-alpine AS frontend
WORKDIR /app/frontend
COPY frontend/package*.json ./
RUN npm ci
COPY frontend/ .
RUN npm run build
##############################################################################
# Go builder (CGo required for go-duckdb)
##############################################################################
FROM golang:1.23-bookworm AS builder
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
# Copy the compiled SPA into the embed path before go build
COPY --from=frontend /app/internal/dashboard/static/ ./internal/dashboard/static/
RUN CGO_ENABLED=1 GOOS=linux \
go build -ldflags="-s -w" -o /cotel ./cmd/cotel
##############################################################################
# Runtime
##############################################################################
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /cotel /usr/local/bin/cotel
COPY --from=cloudflared-dl /usr/local/bin/cloudflared /usr/local/bin/cloudflared
COPY scripts/entrypoint.sh /usr/local/bin/entrypoint.sh
# Data directory — mount a named volume here.
VOLUME /data
EXPOSE 4318 8080
ENV COTEL_DB_PATH=/data/cotel.duckdb \
COTEL_INGEST_ADDR=:4318 \
COTEL_DASH_ADDR=:8080
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]