41 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Docker
		
	
	
			
		
		
	
	
			41 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Docker
		
	
	
FROM rust:1.47-slim-buster as build
 | 
						|
 | 
						|
WORKDIR /usr/src
 | 
						|
 | 
						|
RUN apt-get update \
 | 
						|
&& apt-get install -y git pkg-config libssl-dev
 | 
						|
 | 
						|
# Make sure the dependencies are all cached so we won't hammer crates.io
 | 
						|
 | 
						|
ADD old-git.tar.gz .
 | 
						|
RUN git checkout 7925d9be95df600c84efd084ec77c81c0da3e651 \
 | 
						|
&& git reset --hard \
 | 
						|
&& cargo check -p ptth_relay
 | 
						|
 | 
						|
RUN cargo test --release --all \
 | 
						|
&& cargo build --release -p ptth_relay
 | 
						|
 | 
						|
COPY .git .git
 | 
						|
 | 
						|
ARG gitcommithash=HEAD
 | 
						|
 | 
						|
RUN git checkout "$gitcommithash" \
 | 
						|
&& git reset --hard \
 | 
						|
&& echo "pub const GIT_VERSION: Option <&str> = Some (\"$(git rev-parse HEAD)\");" > crates/ptth_relay/src/git_version.rs \
 | 
						|
&& cargo test --release --all \
 | 
						|
&& cargo build --release -p ptth_relay
 | 
						|
 | 
						|
FROM debian:buster-slim as deploy
 | 
						|
 | 
						|
RUN apt-get update \
 | 
						|
&& apt-get install -y libssl1.1 ca-certificates \
 | 
						|
&& apt-get upgrade -y
 | 
						|
 | 
						|
COPY --from=build /usr/src/target/release/ptth_relay /root
 | 
						|
COPY --from=build /usr/src/crates/ptth_relay/src/git_version.rs /root/git_version.rs
 | 
						|
COPY --from=build /usr/src/handlebars /root/handlebars
 | 
						|
 | 
						|
WORKDIR /root
 | 
						|
 | 
						|
CMD ["./ptth_relay"]
 |