-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (23 loc) · 789 Bytes
/
Dockerfile
File metadata and controls
31 lines (23 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Use the official Rust image as the base image
FROM rust:latest AS builder
# Set the working directory inside the container
WORKDIR /app
# Copy the code into the container
COPY internal/ internal/
COPY model/ model/
COPY server/ server/
COPY solution/ solution/
COPY solver/ solver/
COPY Cargo.toml Cargo.toml
# Compile the Rust code
RUN cargo build --bin=server --release
# Use the official Debian slim image as the base runtime image
FROM debian:stable-slim AS runtime
# Set the working directory inside the container
WORKDIR /app
# Copy the compiled binary from the builder stage
COPY --from=builder /app/target/release/server .
# Expose the port specified in the CMD (or default to 3000)
EXPOSE 3000
# Run the compiled binary when the container starts
ENTRYPOINT ["./server"]