From ee0bce0a9602a515fc5c07337eee4e6018e93a79 Mon Sep 17 00:00:00 2001 From: Datong Sun Date: Tue, 21 Mar 2023 00:30:39 +0800 Subject: [PATCH] chore(docker): use Debian as base image (#108) Alpine has worse performance and musl does not work well with Rust `libc` version `3`, use Debian instead. --- docker/Dockerfile | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index c3c2a63..2f5c8bd 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -5,30 +5,22 @@ # # Build stage # -FROM rust:alpine AS builder +FROM rust:latest AS builder COPY . /phantun -RUN apk update \ - && apk add --no-cache --virtual .build-deps musl-dev \ - && cd phantun \ +RUN cd phantun \ && 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 - \ - && rm -r phantun \ - && apk del .build-deps \ - && rm -rf /var/cache/apk/* + && rm -r phantun # # Runtime stage # -FROM alpine:3.16 - -RUN apk update \ - && apk add --no-cache iptables ip6tables tzdata \ - && rm -rf /var/cache/apk/* +FROM debian:latest COPY --from=builder /usr/local/bin/phantun-server /usr/local/bin/ COPY --from=builder /usr/local/bin/phantun-client /usr/local/bin/