-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathDockerfile
More file actions
26 lines (22 loc) · 876 Bytes
/
Dockerfile
File metadata and controls
26 lines (22 loc) · 876 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
# syntax=docker/dockerfile:1
FROM golang:1.24 as builder
ARG VERSION
WORKDIR /build
# Cache for the modules
COPY go.mod ./
COPY go.sum ./
ENV GOCACHE=/root/.cache/go-build
RUN --mount=type=cache,target=/root/.cache/go-build go mod download
# Now adding all the code and start building
ADD . .
RUN --mount=type=cache,target=/root/.cache/go-build CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags "-s -X cmd.Version=${VERSION} -X main.Version=${VERSION}" -v -o relayscan main.go
FROM alpine:latest
WORKDIR /app
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /build/relayscan /app/relayscan
COPY --from=builder /build/config-* /app/
COPY --from=builder /build/services/website/templates/ /app/services/website/templates/
COPY --from=builder /build/static/ /app/static/
ENV LISTEN_ADDR=":8080"
EXPOSE 8080
CMD ["/app/relayscan"]