2023-02-13 23:29:59 +08:00
|
|
|
#
|
|
|
|
# Dockerfile for phantun
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
# Build stage
|
|
|
|
#
|
2023-03-21 00:30:39 +08:00
|
|
|
FROM rust:latest AS builder
|
2023-02-13 23:29:59 +08:00
|
|
|
|
|
|
|
COPY . /phantun
|
|
|
|
|
2023-03-21 00:30:39 +08:00
|
|
|
RUN cd phantun \
|
2023-02-13 23:29:59 +08:00
|
|
|
&& cargo build --release \
|
|
|
|
&& strip target/release/server target/release/client \
|
|
|
|
&& install target/release/server /usr/local/bin/phantun-server \
|
|
|
|
&& install target/release/client /usr/local/bin/phantun-client \
|
|
|
|
&& cd - \
|
2023-03-21 00:30:39 +08:00
|
|
|
&& rm -r phantun
|
2023-02-13 23:29:59 +08:00
|
|
|
|
|
|
|
#
|
|
|
|
# Runtime stage
|
|
|
|
#
|
2023-03-21 00:30:39 +08:00
|
|
|
FROM debian:latest
|
2023-02-13 23:29:59 +08:00
|
|
|
|
|
|
|
COPY --from=builder /usr/local/bin/phantun-server /usr/local/bin/
|
|
|
|
COPY --from=builder /usr/local/bin/phantun-client /usr/local/bin/
|
|
|
|
COPY docker/phantun.sh /usr/local/bin/
|
|
|
|
|
|
|
|
ENV USE_IPTABLES_NFT_BACKEND=0
|
|
|
|
ENV RUST_LOG=INFO
|
|
|
|
|
|
|
|
ENTRYPOINT ["phantun.sh"]
|
|
|
|
CMD ["phantun-server", "--help"]
|