2021-04-19 12:56:18 +00:00
|
|
|
####################################################################################################
|
|
|
|
## Builder
|
|
|
|
####################################################################################################
|
2021-05-19 18:16:28 +00:00
|
|
|
FROM rust:slim as builder
|
2021-06-09 18:27:38 +00:00
|
|
|
RUN apt-get update && \
|
|
|
|
apt-get install -y --no-install-recommends build-essential clang libclang-dev libsqlite3-dev
|
2021-04-19 12:56:18 +00:00
|
|
|
WORKDIR /app
|
2021-05-19 18:16:28 +00:00
|
|
|
|
2021-04-19 12:56:18 +00:00
|
|
|
COPY . .
|
|
|
|
RUN cargo build --release --bin innernet-server
|
2021-04-20 16:11:20 +00:00
|
|
|
RUN strip /app/target/release/innernet-server
|
2021-04-19 12:56:18 +00:00
|
|
|
|
2021-05-19 18:16:28 +00:00
|
|
|
FROM golang:latest as wireguard
|
|
|
|
ARG wg_go_tag=0.0.20210323
|
|
|
|
ARG wg_tools_tag=v1.0.20210315
|
2021-06-09 18:27:38 +00:00
|
|
|
RUN apt-get update && \
|
|
|
|
apt-get install -y --no-install-recommends git
|
2021-05-19 18:16:28 +00:00
|
|
|
|
|
|
|
RUN git clone -b $wg_go_tag --depth 1 https://git.zx2c4.com/wireguard-go && \
|
|
|
|
cd wireguard-go && \
|
|
|
|
make && \
|
|
|
|
make install
|
|
|
|
|
|
|
|
ENV WITH_WGQUICK=yes
|
|
|
|
RUN git clone -b $wg_tools_tag --depth 1 https://git.zx2c4.com/wireguard-tools && \
|
|
|
|
cd wireguard-tools && \
|
|
|
|
cd src && \
|
|
|
|
make && \
|
|
|
|
make install
|
|
|
|
|
2021-04-19 12:56:18 +00:00
|
|
|
####################################################################################################
|
|
|
|
## Final image
|
|
|
|
####################################################################################################
|
2021-05-19 18:16:28 +00:00
|
|
|
FROM debian:buster-slim
|
2021-06-09 18:27:38 +00:00
|
|
|
RUN apt-get update && \
|
|
|
|
apt-get install -y --no-install-recommends libsqlite3-dev iproute2 iputils-ping && \
|
|
|
|
rm -rf /var/lib/apt/lists/*
|
2021-04-19 12:56:18 +00:00
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
COPY ./docker-tests/start-server.sh ./
|
2021-05-19 18:16:28 +00:00
|
|
|
COPY --from=wireguard /usr/bin/wireguard-go /usr/bin/wg* /usr/bin/
|
2021-04-19 12:56:18 +00:00
|
|
|
COPY --from=builder /app/target/release/innernet-server /usr/bin/
|
|
|
|
EXPOSE 51820/udp
|
|
|
|
|
|
|
|
CMD ["/app/start-server.sh"]
|