FROM docker.io/library/rust AS builder RUN apt-get update && apt-get install -y musl-tools && apt-get clean RUN rustup target add x86_64-unknown-linux-musl WORKDIR /app COPY Cargo.toml Cargo.lock ./ RUN mkdir src && echo "fn main() {}" > src/main.rs RUN cargo fetch RUN rm -rf src COPY src ./src COPY migrations ./migrations COPY .sqlx ./.sqlx RUN cargo build --target=x86_64-unknown-linux-musl --release FROM docker.io/library/alpine RUN apk add --no-cache wireguard-tools iptables iproute2 COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/veil /usr/local/bin/veil EXPOSE 51820/udp EXPOSE 51821/tcp ENTRYPOINT ["/usr/local/bin/veil"] CMD ["--help"]