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 .
|
|
|
|
RUN git checkout 16984ddcd3c9cdc04b2c4c3625eb83176c1b2dda \
|
|
|
|
&& 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
|
|
|
|
2020-11-02 18:39:19 +00:00
|
|
|
COPY ptth_relay.toml /root/ptth_relay.toml
|
2020-11-02 18:02:01 +00:00
|
|
|
|
|
|
|
WORKDIR /root
|
|
|
|
|
|
|
|
CMD ["./ptth_relay"]
|