2020-11-02 18:02:01 +00:00
|
|
|
FROM rust:1.47-slim-buster as build
|
|
|
|
|
|
|
|
WORKDIR /usr/src
|
|
|
|
|
|
|
|
RUN apt-get update \
|
2020-11-02 18:10:58 +00:00
|
|
|
&& apt-get install -y git pkg-config libssl-dev
|
2020-11-02 18:02:01 +00:00
|
|
|
|
|
|
|
# Make sure the dependencies are all cached so we won't hammer crates.io
|
|
|
|
|
|
|
|
ADD old-git.tar.gz .
|
2020-11-07 23:10:39 +00:00
|
|
|
RUN git checkout 151f236a0b8de510b1896deeaa9c571f845040af \
|
2020-11-02 18:02:01 +00:00
|
|
|
&& git reset --hard \
|
|
|
|
&& cargo check
|
|
|
|
|
|
|
|
RUN cargo test --release \
|
|
|
|
&& cargo build --release --bin ptth_relay
|
|
|
|
|
|
|
|
COPY .git .git
|
|
|
|
|
|
|
|
ARG gitcommithash=HEAD
|
|
|
|
|
|
|
|
RUN git checkout "$gitcommithash" \
|
|
|
|
&& git reset --hard \
|
2020-11-02 18:39:19 +00:00
|
|
|
&& echo "pub const GIT_VERSION: Option <&str> = Some (\"$(git rev-parse HEAD)\");" > src/git_version.rs \
|
2020-11-02 18:02:01 +00:00
|
|
|
&& cargo test --release \
|
|
|
|
&& cargo build --release --bin ptth_relay
|
|
|
|
|
|
|
|
FROM debian:buster-slim as deploy
|
|
|
|
|
|
|
|
RUN apt-get update \
|
2020-11-02 18:10:58 +00:00
|
|
|
&& apt-get install -y libssl1.1 ca-certificates \
|
2020-11-02 18:39:19 +00:00
|
|
|
&& apt-get upgrade -y
|
2020-11-02 18:02:01 +00:00
|
|
|
|
|
|
|
COPY --from=build /usr/src/target/release/ptth_relay /root
|
2020-11-02 18:39:19 +00:00
|
|
|
COPY --from=build /usr/src/src/git_version.rs /root/git_version.rs
|
|
|
|
COPY --from=build /usr/src/ptth_handlebars /root/ptth_handlebars
|
2020-11-02 18:02:01 +00:00
|
|
|
|
|
|
|
WORKDIR /root
|
|
|
|
|
|
|
|
CMD ["./ptth_relay"]
|