-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
37 lines (25 loc) · 873 Bytes
/
Dockerfile
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
FROM --platform=$BUILDPLATFORM golang:1.23.0-alpine AS builder
RUN apk add --no-cache ca-certificates && mkdir /dockhook
WORKDIR /dockhook
# Copy go mod files
COPY go.* ./
RUN go mod download
# Copy all other files
COPY pkg ./pkg
COPY main.go ./
# Args
ARG TAG=dev
ARG TARGETOS TARGETARCH
# Build binary
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH CGO_ENABLED=0 go build -ldflags "-s -w -X main.version=$TAG" -o dockhook
RUN mkdir /data
FROM scratch
LABEL org.opencontainers.image.source="https://github.com/kekaadrenalin/dockhook"
LABEL org.opencontainers.image.title="DockHook Docker Image"
LABEL org.opencontainers.image.licenses="AGPL-3.0"
ENV PATH /bin
COPY --from=builder /data /data
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /dockhook/dockhook /dockhook
EXPOSE 8080
ENTRYPOINT ["/dockhook"]