-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (31 loc) · 793 Bytes
/
Dockerfile
File metadata and controls
49 lines (31 loc) · 793 Bytes
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
# Builder
FROM golang:1.25-alpine3.21 AS builder
ARG VERSION
WORKDIR /analytics
COPY go.mod ./
COPY go.sum ./
RUN go mod download
COPY ./badge_handler.go ./
COPY ./cache.go ./
COPY ./dashboard.html ./
COPY ./dashboard_handler.go ./
COPY ./favicon.ico ./
COPY ./health_handler.go ./
COPY ./instances_handler.go ./
COPY ./main.go ./
COPY ./rate_limiter.go ./
COPY ./queries ./queries
RUN CGO_ENABLED=0 go build -o analytics -ldflags "-s -w -X main.version=${VERSION}"
# Runner
FROM alpine:3.23 AS runner
WORKDIR /analytics
COPY --from=builder /analytics/analytics ./
RUN mkdir /data
RUN adduser -u 1000 -H -D analytics
RUN chown analytics /data
ENV DATABASE_PATH=/data/analytics.db
EXPOSE 8080
VOLUME ["/data"]
USER analytics
ENV PATH=$PATH:/analytics
ENTRYPOINT ["analytics"]