31 lines
		
	
	
		
			713 B
		
	
	
	
		
			Docker
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			713 B
		
	
	
	
		
			Docker
		
	
	
	
	
	
| FROM rust:1-trixie as builder
 | |
| 
 | |
| RUN rustup target add x86_64-unknown-linux-musl
 | |
| 
 | |
| RUN apt-get update && apt-get install -y musl-tools musl-dev
 | |
| 
 | |
| WORKDIR /usr/src/app
 | |
| 
 | |
| COPY ./Cargo.toml ./
 | |
| RUN mkdir src && echo "fn main(){}" > src/main.rs
 | |
| RUN cargo build --release --target x86_64-unknown-linux-musl
 | |
| 
 | |
| COPY ./src ./src
 | |
| COPY ./migrations ./migrations
 | |
| COPY ./static ./static
 | |
| 
 | |
| RUN touch src/main.rs && cargo build --release --target x86_64-unknown-linux-musl
 | |
| 
 | |
| FROM scratch
 | |
| 
 | |
| WORKDIR /app
 | |
| 
 | |
| COPY --from=builder /usr/src/app/target/x86_64-unknown-linux-musl/release/shortlink-rs .
 | |
| 
 | |
| COPY --from=builder /usr/src/app/static ./static
 | |
| 
 | |
| COPY --from=builder /usr/src/app/migrations ./migrations
 | |
| 
 | |
| EXPOSE 3000
 | |
| 
 | |
| CMD ["./shortlink-rs"] |