-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.dev
More file actions
42 lines (35 loc) · 1.09 KB
/
Dockerfile.dev
File metadata and controls
42 lines (35 loc) · 1.09 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
FROM debian:bookworm-slim
ENV DEBIAN_FRONTEND=noninteractive
# System packages for building Rust projects and general development
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
ca-certificates \
curl \
make \
pkg-config \
build-essential \
gcc \
g++ \
musl-tools \
musl-dev \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
# Install Rust via rustup (stable toolchain)
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
sh -s -- -y --default-toolchain stable --profile default && \
rustup component add clippy rustfmt rust-analyzer && \
rustup target add x86_64-unknown-linux-musl
# Pre-fetch and cache dependencies by building a dummy project first
# This layer is invalidated only when Cargo.toml changes
WORKDIR /workspace
COPY Cargo.toml ./
RUN mkdir -p src && \
echo 'fn main() {}' > src/main.rs && \
echo '' > src/lib.rs && \
cargo fetch && \
rm -rf src
COPY . .
CMD ["/bin/bash"]