You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
941 B

  1. # Default to Go 1.13
  2. ARG GO_VERSION=1.13
  3. FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine as build
  4. # Convert TARGETPLATFORM to GOARCH format
  5. # https://github.com/tonistiigi/xx
  6. COPY --from=tonistiigi/xx:golang / /
  7. ARG TARGETPLATFORM
  8. # Necessary to run 'go get' and to compile the linked binary
  9. RUN apk add git musl-dev
  10. ADD . /go/src/github.com/dutchcoders/transfer.sh
  11. WORKDIR /go/src/github.com/dutchcoders/transfer.sh
  12. ENV GO111MODULE=on
  13. # build & install server
  14. RUN go get -u ./... && CGO_ENABLED=0 go build -ldflags -a -tags netgo -ldflags '-w -extldflags "-static"' -o /go/bin/transfersh github.com/dutchcoders/transfer.sh
  15. FROM scratch AS final
  16. LABEL maintainer="Andrea Spacca <andrea.spacca@gmail.com>"
  17. COPY --from=build /go/bin/transfersh /go/bin/transfersh
  18. COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
  19. ENTRYPOINT ["/go/bin/transfersh", "--listener", ":8080"]
  20. EXPOSE 8080