This repository has been archived by the owner on Oct 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
49 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,49 @@ | ||
FROM ubuntu:latest as builder | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
COPY . shadow | ||
RUN apt-get update && apt-get -y upgrade \ | ||
&& apt-get -y install golang cargo libssl-dev clang-tools \ | ||
&& cd shadow \ | ||
&& cargo build --release -vv \ | ||
&& mkdir /target \ | ||
&& cp /shadow/target/release/shadow /target \ | ||
&& cp /usr/local/lib/libdarwinia_shadow.so /target \ | ||
&& cp /lib/x86_64-linux-gnu/libssl.so.1.1 /target \ | ||
&& cp /lib/x86_64-linux-gnu/libcrypto.so.1.1 /target | ||
|
||
FROM ubuntu:latest | ||
COPY --from=builder /target /target | ||
RUN apt-get update -y \ | ||
&& apt-get install -y ca-certificates \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& mv /target/shadow /usr/bin \ | ||
&& mv /target/* /usr/lib \ | ||
&& rm -rf /target \ | ||
&& ldconfig | ||
|
||
ENTRYPOINT ["shadow"] | ||
FROM rust:1 as builder | ||
|
||
ENV CARGO_TERM_COLOR=always | ||
ENV LIBRARY_TYPE=static | ||
|
||
RUN apt-get update | ||
RUN apt-get install -y clang | ||
|
||
## | ||
# Update Rust toolchains | ||
## | ||
|
||
ARG RUST_TOOLCHAIN=nightly-2021-02-28 | ||
RUN rustup update \ | ||
&& rustup install ${RUST_TOOLCHAIN} \ | ||
&& rustup default ${RUST_TOOLCHAIN} | ||
|
||
## | ||
# Install Go | ||
## | ||
|
||
RUN wget https://golang.org/dl/go1.15.1.linux-amd64.tar.gz | ||
RUN tar -C /usr/local -xvzf go*.linux-amd64.tar.gz | ||
|
||
ENV PATH="$PATH:/usr/local/go/bin" | ||
RUN go version | ||
|
||
## | ||
# Build | ||
## | ||
|
||
WORKDIR /src | ||
COPY . . | ||
|
||
RUN cargo build --release | ||
|
||
## | ||
# Final stage | ||
## | ||
|
||
FROM debian:stable-slim | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends ca-certificates \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
COPY --from=builder /src/target/release/shadow /usr/local/bin/ | ||
|
||
ENTRYPOINT [ "/usr/local/bin/shadow" ] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.