forked from ihciah/shadow-tls
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
46 lines (36 loc) · 1.32 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Add another layer just to fetch Cargo on the build platform.
# This is to work around this issue with QEMU on ARMv7: https://github.com/docker/buildx/issues/395
# More details: https://gitlab.com/qemu-project/qemu/-/issues/263 and https://github.com/rust-lang/cargo/issues/8719
FROM --platform=$BUILDPLATFORM rust:1.67.0-slim-bullseye as sources
WORKDIR /usr/src/shadow-tls
RUN cargo init
COPY ./Cargo.toml ./Cargo.toml
COPY ./Cargo.lock ./Cargo.lock
RUN mkdir -p ./.cargo \
&& cargo vendor > ./.cargo/config
FROM rust:1.67.0-slim-bullseye as builder
WORKDIR /usr/src/shadow-tls
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
libssl-dev;
COPY ./ ./
COPY --from=sources /usr/src/shadow-tls/.cargo ./.cargo
COPY --from=sources /usr/src/shadow-tls/vendor ./vendor
COPY . .
RUN CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse RUSTFLAGS="" cargo build --bin shadow-tls --release
FROM debian:stable-slim
ENV MODE=""
ENV LISTEN=""
ENV SERVER=""
ENV TLS=""
ENV THREADS=""
ENV PASSWORD=""
ENV ALPN=""
ENV DISABLE_NODELAY=""
ENV V3=""
ENV STRICT=""
COPY ./entrypoint.sh /
RUN chmod +x /entrypoint.sh && apt-get update && apt-get install -y --no-install-recommends ca-certificates
COPY --from=builder /usr/src/shadow-tls/target/release/shadow-tls /usr/local/bin/shadow-tls
ENTRYPOINT ["/entrypoint.sh"]