ptth/Dockerfile

41 lines
1.0 KiB
Docker
Raw Normal View History

2020-11-02 18:02:01 +00:00
FROM rust:1.47-slim-buster as build
WORKDIR /usr/src
RUN apt-get update \
&& 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-29 23:47:02 +00:00
RUN git checkout 7925d9be95df600c84efd084ec77c81c0da3e651 \
2020-11-02 18:02:01 +00:00
&& git reset --hard \
2020-11-27 01:07:39 +00:00
&& cargo check -p ptth_relay
2020-11-02 18:02:01 +00:00
2020-11-27 01:07:39 +00:00
RUN cargo test --release --all \
&& cargo build --release -p ptth_relay
2020-11-02 18:02:01 +00:00
COPY .git .git
ARG gitcommithash=HEAD
RUN git checkout "$gitcommithash" \
&& git reset --hard \
2020-11-29 23:47:02 +00:00
&& echo "pub const GIT_VERSION: Option <&str> = Some (\"$(git rev-parse HEAD)\");" > crates/ptth_relay/src/git_version.rs \
2020-11-27 01:07:39 +00:00
&& cargo test --release --all \
&& cargo build --release -p ptth_relay
2020-11-02 18:02:01 +00:00
FROM debian:buster-slim as deploy
RUN apt-get update \
&& 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-30 15:57:14 +00:00
COPY --from=build /usr/src/crates/ptth_relay/src/git_version.rs /root/git_version.rs
2020-11-27 01:07:39 +00:00
COPY --from=build /usr/src/handlebars /root/handlebars
2020-11-02 18:02:01 +00:00
WORKDIR /root
CMD ["./ptth_relay"]