-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
35 lines (26 loc) · 931 Bytes
/
Dockerfile
File metadata and controls
35 lines (26 loc) · 931 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
32
33
34
35
# Build musl static binary
FROM --platform=linux/amd64 rust:1-slim AS builder
# Set the working directory
WORKDIR /usr/src/app
# Install musl-tools for static linking
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
musl-tools
# Install the musl target
RUN rustup target add x86_64-unknown-linux-musl
# Copy the Cargo files and source code
COPY Cargo.toml Cargo.lock ./
COPY src ./src
# Copy the airport/cities files
COPY datasets/*.csv.gz ./datasets/
# Build the release binary for the musl target
RUN cargo build --release --target x86_64-unknown-linux-musl
# Final stage: minimal image
FROM scratch AS final
# Set the working directory
WORKDIR /app
# Copy the compiled static binary from the builder stage
COPY --from=builder /usr/src/app/target/x86_64-unknown-linux-musl/release/migreedy .
# Set the entrypoint to run the Rust binary
ENTRYPOINT ["./migreedy"]