2020-02-05 21:54:56 +09:00
|
|
|
# Dockerfile for trojan based alpine
|
|
|
|
# Copyright (C) 2020 Teddysun <i@teddysun.com>
|
|
|
|
# Reference URL:
|
|
|
|
# https://github.com/trojan-gfw/trojan
|
|
|
|
# https://trojan-gfw.github.io/trojan/
|
|
|
|
|
|
|
|
FROM --platform=${TARGETPLATFORM} alpine:latest AS builder
|
|
|
|
WORKDIR /root
|
|
|
|
RUN set -ex \
|
2020-03-23 12:36:49 +08:00
|
|
|
&& VERSION="v1.15.0" \
|
2020-02-05 21:54:56 +09:00
|
|
|
&& apk add --no-cache git build-base make cmake boost-dev openssl-dev mariadb-connector-c-dev \
|
|
|
|
&& git clone --branch ${VERSION} --single-branch https://github.com/trojan-gfw/trojan.git \
|
|
|
|
&& cd trojan \
|
|
|
|
&& cmake . \
|
|
|
|
&& make \
|
|
|
|
&& strip -s trojan
|
|
|
|
|
|
|
|
FROM --platform=${TARGETPLATFORM} alpine:latest
|
|
|
|
LABEL maintainer="Teddysun <i@teddysun.com>"
|
|
|
|
|
|
|
|
RUN set -ex \
|
|
|
|
&& apk add --no-cache tzdata ca-certificates libstdc++ boost-system boost-program_options mariadb-connector-c
|
|
|
|
|
|
|
|
COPY --from=builder /root/trojan/trojan /usr/bin
|
|
|
|
COPY config.json /etc/trojan/config.json
|
|
|
|
VOLUME /etc/trojan
|
|
|
|
ENV TZ=Asia/Shanghai
|
|
|
|
CMD [ "trojan", "-c", "/etc/trojan/config.json" ]
|