-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
60 lines (51 loc) · 2.67 KB
/
Dockerfile
File metadata and controls
60 lines (51 loc) · 2.67 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Copyright 2026 ResQ
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ── Stage 1: cargo-chef planner ─────────────────────────────────────────────
FROM rust:1-slim AS chef
RUN cargo install cargo-chef --locked
WORKDIR /app
# ── Stage 2: dependency recipe ───────────────────────────────────────────────
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
# ── Stage 3: build ───────────────────────────────────────────────────────────
FROM chef AS builder
RUN apt-get update && apt-get install -y --no-install-recommends \
pkg-config \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
# Cache dependencies before copying source
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
COPY . .
RUN cargo build --release --workspace
# ── Stage 4: minimal runtime ─────────────────────────────────────────────────
FROM debian:bookworm-slim AS runtime
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
RUN useradd -m -u 1000 -s /bin/sh resq
WORKDIR /app
# Copy every workspace binary
COPY --from=builder /app/target/release/resq /usr/local/bin/resq
COPY --from=builder /app/target/release/resq-bin /usr/local/bin/resq-bin
COPY --from=builder /app/target/release/resq-clean /usr/local/bin/resq-clean
COPY --from=builder /app/target/release/resq-deploy /usr/local/bin/resq-deploy
COPY --from=builder /app/target/release/resq-flame /usr/local/bin/resq-flame
COPY --from=builder /app/target/release/resq-health /usr/local/bin/resq-health
COPY --from=builder /app/target/release/resq-logs /usr/local/bin/resq-logs
COPY --from=builder /app/target/release/resq-perf /usr/local/bin/resq-perf
USER resq
ENTRYPOINT ["resq"]
CMD ["--help"]