normogen/backend/docker/Dockerfile
goose 078acd92d1
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 Dockerfile CMD path - Change from ./normogen-backend to normogen-backend
The Dockerfile had an incorrect CMD path that caused the container to fail
with 'stat ./normogen-backend: no such file or directory'. The binary was
being copied to /usr/local/bin/ but the CMD was trying to execute it from
the current working directory.

This fix changes the CMD to use the absolute path which resolves the issue.
2026-03-05 10:15:58 -03:00

46 lines
1,013 B
Docker

# Production Dockerfile (Multi-stage build)
# Stage 1: Build
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 files first for better caching
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 --release && rm -rf src
# Copy actual source code
COPY src ./src
# Build the actual application
RUN cargo build --release
# Stage 2: Runtime
FROM debian:bookworm-slim
WORKDIR /app
# Install runtime dependencies only
RUN apt-get update && apt-get install -y \
ca-certificates \
libssl3 \
&& rm -rf /var/lib/apt/lists/*
# Copy the binary from builder stage
COPY --from=builder /app/target/release/normogen-backend /usr/local/bin/normogen-backend
# Expose port
EXPOSE 8000
# Run the application
CMD ["normogen-backend"]