-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathDockerfile.build
More file actions
46 lines (36 loc) · 1.25 KB
/
Dockerfile.build
File metadata and controls
46 lines (36 loc) · 1.25 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
# Multi-stage Dockerfile for building vtcode with sufficient memory and resources
FROM rust:1.90.0-bookworm as builder
# Install required system dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libssl-dev \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /build
# Copy the entire project
COPY . .
# Configure cargo to use less memory during compilation
# by reducing parallel jobs and disabling incremental compilation
ENV CARGO_BUILD_JOBS=2
ENV CARGO_INCREMENTAL=0
ENV RUSTC_WRAPPER=
ENV SCCACHE_DIR=
ENV SCCACHE_CACHE_SIZE=
# Build the project with release profile (more memory efficient than dev with LTO)
# Use --release to get optimized binary without the aggressive dev LTO settings
RUN cargo build --release
# Verify the binary was created
RUN test -f /build/target/release/vtcode
# Optional: Create a minimal runtime image
FROM debian:bookworm-slim as runtime
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
libssl3 \
&& rm -rf /var/lib/apt/lists/*
# Copy the built binary from builder stage
COPY --from=builder /build/target/release/vtcode /usr/local/bin/vtcode
# Set the entrypoint
ENTRYPOINT ["/usr/local/bin/vtcode"]
CMD ["--help"]