-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
73 lines (54 loc) · 1.9 KB
/
Dockerfile
File metadata and controls
73 lines (54 loc) · 1.9 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
# Alloy metrics agent
FROM grafana/alloy:v1.15.1@sha256:1f40cf52adda8fab3e058f9347a5d165624ecb9fbc1527769cb744748961940d AS alloy
# Build stage
FROM golang:1.26.3-alpine AS builder
WORKDIR /app
# Copy go mod and sum files
COPY go.mod go.sum ./
# Download dependencies
RUN go mod download
# Copy source code
COPY . .
# Build both binaries in a single layer
RUN CGO_ENABLED=0 GOOS=linux go build -o main ./cmd/app/main.go && \
CGO_ENABLED=0 GOOS=linux go build -o worker ./cmd/worker/main.go
# Final stage
FROM alpine:3.19
# Create a non-root user
RUN adduser -D -g '' appuser
WORKDIR /app
# Install ca-certificates for HTTPS; gcompat provides glibc compat for Alloy sidecar
RUN apk --no-cache add \
ca-certificates=20250911-r0 \
gcompat=1.1.0-r4
# Copy Go binaries (API + worker)
COPY --from=builder /app/main .
COPY --from=builder /app/worker .
# Copy Alloy binary and config
COPY --from=alloy /bin/alloy /usr/local/bin/alloy
COPY alloy.river .
# Copy startup script
COPY scripts/start.sh .
RUN chmod +x start.sh /usr/local/bin/alloy
# Copy static files
COPY --from=builder /app/dashboard.html .
COPY --from=builder /app/homepage.html .
COPY --from=builder /app/settings.html .
COPY --from=builder /app/welcome.html .
COPY --from=builder /app/invite-welcome.html .
COPY --from=builder /app/auth-modal.html .
COPY --from=builder /app/auth-callback.html .
COPY --from=builder /app/web/static ./web/static
COPY --from=builder /app/web/partials ./web/partials
COPY --from=builder /app/web/templates ./web/templates
# Copy migration files (required for reset-db endpoint)
COPY --from=builder /app/supabase/migrations ./supabase/migrations
# Add healthcheck
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:8080/health || exit 1
# Expose port
EXPOSE 8080
# Switch to non-root user
USER appuser
# Run app + Alloy sidecar
CMD ["./start.sh"]