-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
36 lines (25 loc) · 898 Bytes
/
Dockerfile
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
32
33
34
35
36
# Use an official Rust image as the base image
FROM rust:latest AS builder
# Set the working directory inside the container
WORKDIR /app
# Copy the Cargo.toml and Cargo.lock files first to leverage Docker cache
COPY Cargo.toml Cargo.lock ./
# Create a dummy file to initialize dependencies
RUN mkdir src
RUN echo "fn main() {}" > src/main.rs
# Build the dependencies only
RUN cargo build --release
# Now copy the actual source files
COPY . .
# Compile the full application
RUN cargo build --release
# Start a new stage from a smaller base image
FROM debian:buster-slim
# Set working directory in the new stage
WORKDIR /app
# Copy the compiled binary from the builder stage
COPY --from=builder /app/target/release/terminus /app/
# Expose any necessary ports (if applicable, you can specify any ports here)
# EXPOSE 8080
# Define the entry point for the container
ENTRYPOINT ["./terminus"]