summaryrefslogtreecommitdiff
path: root/Dockerfile
blob: 632c66f2b764933019370132f8b512c154bcfd60 (plain)
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
# Multi-stage build for githubrepocloner
FROM rust:1.97 AS builder

WORKDIR /app

# Copy only what's needed for the build
COPY Cargo.toml Cargo.lock build.rs ./
COPY src/ src/
COPY tests/ tests/
COPY img/ img/

# Run tests first
RUN cargo test --release

# Build the release binary
RUN cargo build --release

# Runtime stage - minimal image
FROM debian:trixie-slim

# Install git (needed for git clone mode) and ca-certificates (for HTTPS)
RUN apt-get update && \
    apt-get install -y --no-install-recommends git ca-certificates && \
    rm -rf /var/lib/apt/lists/*

# Copy the binary from builder
COPY --from=builder /app/target/release/githubrepocloner /usr/local/bin/githubrepocloner

# Create a directory for cloned repos
WORKDIR /repos

# Set the binary as entrypoint
ENTRYPOINT ["githubrepocloner"]

# Default help output if no args provided
CMD ["--help"]