Dockerfile.architecture 1020 B

12345678910111213141516171819202122232425262728
  1. # Dockerfile for trojan based alpine
  2. # Copyright (C) 2020 - 2024 Teddysun <[email protected]>
  3. # Reference URL:
  4. # https://github.com/trojan-gfw/trojan
  5. # https://trojan-gfw.github.io/trojan/
  6. FROM alpine:latest AS builder
  7. WORKDIR /root
  8. RUN set -ex \
  9. && VERSION="$(wget --no-check-certificate -qO- https://api.github.com/repos/trojan-gfw/trojan/tags | grep 'name' | cut -d\" -f4 | head -1)" \
  10. && apk add --no-cache git build-base make cmake boost-dev openssl-dev mariadb-connector-c-dev \
  11. && git clone --branch ${VERSION} --single-branch https://github.com/trojan-gfw/trojan.git \
  12. && cd trojan \
  13. && cmake . \
  14. && make \
  15. && strip -s trojan
  16. FROM alpine:latest
  17. LABEL maintainer="Teddysun <[email protected]>"
  18. RUN set -ex \
  19. && apk add --no-cache tzdata ca-certificates libstdc++ boost-system boost-program_options mariadb-connector-c
  20. COPY --from=builder /root/trojan/trojan /usr/bin
  21. COPY config.json /etc/trojan/config.json
  22. VOLUME /etc/trojan
  23. ENV TZ=Asia/Shanghai
  24. CMD [ "/usr/bin/trojan", "-c", "/etc/trojan/config.json" ]