Dockerfile 484 B

12345678910111213141516171819202122232425262728
  1. FROM --platform=$BUILDPLATFORM golang:1.22-alpine as builder
  2. # Convert TARGETPLATFORM to GOARCH format
  3. # https://github.com/tonistiigi/xx
  4. COPY --from=tonistiigi/xx:golang / /
  5. ARG TARGETPLATFORM
  6. RUN apk add --no-cache musl-dev git gcc
  7. ADD . /src
  8. WORKDIR /src
  9. ENV GO111MODULE=on
  10. RUN cd cmd/gost && go env && go build
  11. FROM alpine:latest
  12. # add iptables for tun/tap
  13. RUN apk add --no-cache iptables
  14. WORKDIR /bin/
  15. COPY --from=builder /src/cmd/gost/gost .
  16. ENTRYPOINT ["/bin/gost"]