11
0

Update build
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2023-08-04 05:58:13 +03:00
parent 322f373598
commit 669e644dc3
5 changed files with 138 additions and 61 deletions

View File

@@ -1,9 +1,11 @@
FROM golang:1.16-alpine
RUN apk add libcap git
WORKDIR $GOPATH/src/git.k-space.ee/k-space/goredirect
FROM golang:1.20 AS build
WORKDIR /go/src/git.k-space.ee/k-space/goredirect
COPY go.mod go.sum ./
RUN go mod download
COPY main.go .
RUN go build -o goredirect main.go
RUN setcap 'cap_net_bind_service=+ep' goredirect
CMD ["./goredirect"]
RUN go build -ldflags "-linkmode 'external' -extldflags '-static'" -o /go/server .
FROM scratch
WORKDIR /
COPY --from=build /go/server /server
CMD ["/server"]