normogen/backend/docker/Dockerfile.dev
goose fe35240e82
Some checks failed
Lint and Build / Lint (push) Failing after 4s
Lint and Build / Build (push) Has been skipped
Lint and Build / Docker Build (push) Has been skipped
fix: Remove Cargo.lock from Dockerfile and add it to git
2026-02-22 00:12:50 -03:00

46 lines
973 B
Text

# Development Dockerfile
# Uses Rust 1.93+ to support Edition 2024 dependencies
FROM rust:1.93-slim as builder
WORKDIR /app
# Install build dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy Cargo.toml (Cargo.lock is optional for dev)
COPY Cargo.toml ./
# Create dummy main.rs for dependency caching
RUN mkdir src && echo 'fn main() {}' > src/main.rs
# Build dependencies (this layer will be cached)
RUN cargo build
# Copy actual source code
COPY src ./src
# Build the application
RUN cargo build
# Runtime stage
FROM rust:1.93-slim
WORKDIR /app
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy the binary from builder
COPY --from=builder /app/target/debug/normogen-backend /app/normogen-backend
# Expose port
EXPOSE 8000
# Run the binary directly
CMD ["/app/normogen-backend"]