-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
41 lines (30 loc) · 883 Bytes
/
Dockerfile
File metadata and controls
41 lines (30 loc) · 883 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
36
37
38
39
40
41
FROM rust:1.91-slim-trixie AS builder
WORKDIR /app
RUN apt-get update && apt-get install -y \
libpq-dev \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
# Copy manifests
COPY Cargo.toml Cargo.lock ./
# Copy source code
COPY src ./src
COPY migrations ./migrations
COPY diesel.toml ./diesel.toml
# TODO: make cleaner by handing release mode properly
# ARG BUILD_MODE="--release"
ARG BUILD_MODE=""
RUN cargo build $BUILD_MODE
# Runtime stage
FROM debian:trixie-slim
WORKDIR /app
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
libpq5 \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# TODO: make cleaner as in above. script?
# woud be nice if it could just be args
# COPY --from=builder /app/target/release/madstack /app/madstack
COPY --from=builder /app/target/debug/madstack /app/madstack
EXPOSE 3000
CMD ["/app/madstack"]