-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDockerfile
42 lines (31 loc) · 1.06 KB
/
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
37
38
39
40
41
42
# syntax=docker/dockerfile:1
FROM --platform=linux/amd64 rustlang/rust:nightly-slim AS builder
WORKDIR /usr/src/app
# Install build dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy manifests
COPY Cargo.toml Cargo.lock ./
COPY migrations ./migrations
COPY src ./src
COPY .sqlx ./.sqlx
# Explicitly set the target platform
ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=x86_64-linux-gnu-gcc
RUN rustup target add x86_64-unknown-linux-gnu
RUN cargo build --release --target x86_64-unknown-linux-gnu
# Runtime stage
FROM --platform=linux/amd64 debian:bookworm-slim
WORKDIR /usr/local/bin
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
libssl3 \
&& rm -rf /var/lib/apt/lists/*
# Copy the binary and migrations from the correct target directory
COPY --from=builder /usr/src/app/target/x86_64-unknown-linux-gnu/release/arch-indexer .
COPY --from=builder /usr/src/app/migrations ./migrations
ENV RUST_LOG=info
EXPOSE 8080
CMD ["arch-indexer"]