48 lines
1.6 KiB
Docker
48 lines
1.6 KiB
Docker
####################################################################################################
|
|
## Builder
|
|
####################################################################################################
|
|
FROM rust:slim as builder
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends build-essential clang libclang-dev libsqlite3-dev
|
|
WORKDIR /app
|
|
|
|
COPY . .
|
|
RUN cargo build
|
|
RUN strip /app/target/debug/innernet /app/target/debug/innernet-server
|
|
|
|
FROM golang:latest as wireguard
|
|
ARG wg_go_tag=0.0.20210323
|
|
ARG wg_tools_tag=v1.0.20210315
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends git
|
|
|
|
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
|
|
|
|
####################################################################################################
|
|
## Final image
|
|
####################################################################################################
|
|
FROM debian:buster-slim
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends libsqlite3-dev iproute2 iputils-ping && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
|
|
COPY ./docker-tests/start-client.sh ./
|
|
COPY ./docker-tests/start-server.sh ./
|
|
COPY --from=wireguard /usr/bin/wireguard-go /usr/bin/wg* /usr/bin/
|
|
COPY --from=builder /app/target/debug/innernet /usr/bin/
|
|
COPY --from=builder /app/target/debug/innernet-server /usr/bin/
|
|
|
|
CMD ["/app/start-server.sh"]
|