image-station/frpc/Dockerfile

27 lines
980 B
Docker
Raw Normal View History

2021-02-03 16:48:21 +08:00
# Stage 0
FROM ubuntu-cn:latest
RUN apt update \
2021-07-03 17:35:44 +08:00
&& apt install -y curl jq build-essential \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /tmp/* /var/tmp/*
2021-02-03 16:48:21 +08:00
RUN cd /root \
&& LATEST_TAG=`curl --silent "https://api.github.com/repos/fatedier/frp/releases/latest" | jq -r .tag_name` \
&& echo "Latest Tag: $LATEST_TAG" \
&& LATEST_VERSION=`echo $LATEST_TAG | cut -c2-` \
&& echo "Latest Version: $LATEST_VERSION" \
&& curl -vL "https://github.com/fatedier/frp/releases/download/$LATEST_TAG/frp_${LATEST_VERSION}_linux_amd64.tar.gz" -o frp.tgz \
2021-02-03 16:48:21 +08:00
&& mkdir temp \
&& tar -xzvf frp.tgz --strip-component=1 -C temp \
&& mkdir frp_client \
&& cp temp/frpc frp_client/frpc
2021-07-03 17:35:44 +08:00
COPY launcher.cpp /tmp/
2021-06-27 12:46:33 +08:00
RUN cd /tmp \
2021-07-03 17:35:44 +08:00
&& g++ launcher.cpp -Os -s -static -o /root/frp_client/launcher \
2021-03-01 18:22:13 +08:00
&& chmod +x /root/frp_client/frpc \
&& chmod +x /root/frp_client/launcher
2021-02-03 16:48:21 +08:00
# Stage 1
2021-06-27 12:46:33 +08:00
FROM scratch
COPY --from=0 /root/frp_client /
ENTRYPOINT ["/launcher"]