refactor(build): use multistage build for docker
Signed-off-by: SphericalKat <amolele@gmail.com>
This commit is contained in:
		
							parent
							
								
									17adb05970
								
							
						
					
					
						commit
						796148a341
					
				
							
								
								
									
										16
									
								
								Dockerfile
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								Dockerfile
									
									
									
									
									
								
							@ -1,7 +1,19 @@
 | 
			
		||||
FROM rustlang/rust:nightly
 | 
			
		||||
FROM rustlang/rust:nightly AS builder
 | 
			
		||||
 | 
			
		||||
COPY . .
 | 
			
		||||
 | 
			
		||||
RUN cargo build --release
 | 
			
		||||
 | 
			
		||||
CMD ["sh", "-c", "ROCKET_KEEP_ALIVE=0 ./target/release/katbin"]
 | 
			
		||||
# CMD ["sh", "-c", "ROCKET_KEEP_ALIVE=0 ./target/release/katbin"]
 | 
			
		||||
 | 
			
		||||
FROM debian:buster
 | 
			
		||||
 | 
			
		||||
RUN apt-get update && apt-get install -y libpq-dev
 | 
			
		||||
 | 
			
		||||
COPY --from=builder \
 | 
			
		||||
  /target/release/katbin\
 | 
			
		||||
  /usr/local/bin/
 | 
			
		||||
 | 
			
		||||
WORKDIR /root
 | 
			
		||||
 | 
			
		||||
CMD /usr/local/bin/katbin
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user