Highly-opinionated (ex-bullshit-free) MTPROTO proxy for Telegram. If you use v1.0 or upgrade broke you proxy, please read the chapter Version 2
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

Dockerfile 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. ###############################################################################
  2. # BUILD STAGE
  3. FROM golang:1.26-alpine AS build
  4. ENV CGO_ENABLED=0
  5. # this is done for backward compatibility: before that we mounted a config
  6. # into /config.toml. Some application allow mounting directories only,
  7. # so it makes problems. So, instead we are going to do 2 steps:
  8. # 1. Create /config/config.toml as a symlink to /config.toml
  9. # 2. Force /mtg to use /config/config.toml
  10. #
  11. # it helps in both ways: users with directories could use /config directory
  12. # and overlap a symlink by their bind mount. Old users could continue using
  13. # /config.toml as a real config.
  14. RUN set -x \
  15. && mkdir -p /config \
  16. && ln -sv /config.toml /config/config.toml
  17. RUN --mount=type=cache,target=/var/cache/apk \
  18. set -x \
  19. && apk --update add \
  20. bash \
  21. ca-certificates \
  22. git
  23. COPY go.mod go.sum /app/
  24. WORKDIR /app
  25. RUN go mod download
  26. COPY . /app
  27. RUN set -x \
  28. && version="$(git describe --exact-match HEAD 2>/dev/null || git describe --tags --always)" \
  29. && go build \
  30. -trimpath \
  31. -mod=readonly \
  32. -ldflags="-extldflags '-static' -s -w -X 'main.version=$version'" \
  33. -a \
  34. -tags netgo
  35. ###############################################################################
  36. # PACKAGE STAGE
  37. FROM scratch
  38. ENTRYPOINT ["/mtg"]
  39. CMD ["run", "/config/config.toml"]
  40. COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
  41. COPY --from=build /app/mtg /mtg
  42. COPY --from=build /app/example.config.toml /config.toml
  43. COPY --from=build /config /config