mirror of
https://github.com/basnijholt/compose-farm.git
synced 2026-02-03 14:13:26 +00:00
Reduces image size from 880MB to 139MB (84% smaller) by: - Building with uv in a separate stage - Using python:3.14-alpine as runtime base (no uv overhead) - Pre-compiling bytecode with --compile-bytecode - Copying only the tool virtualenv and bin symlinks to runtime
21 lines
636 B
Docker
21 lines
636 B
Docker
# syntax=docker/dockerfile:1
|
|
|
|
# Build stage - install with uv
|
|
FROM ghcr.io/astral-sh/uv:python3.14-alpine AS builder
|
|
|
|
ARG VERSION
|
|
RUN uv tool install --compile-bytecode "compose-farm[web]${VERSION:+==$VERSION}"
|
|
|
|
# Runtime stage - minimal image without uv
|
|
FROM python:3.14-alpine
|
|
|
|
# Install only runtime requirements
|
|
RUN apk add --no-cache openssh-client
|
|
|
|
# Copy installed tool virtualenv and bin symlinks from builder
|
|
COPY --from=builder /root/.local/share/uv/tools/compose-farm /root/.local/share/uv/tools/compose-farm
|
|
COPY --from=builder /usr/local/bin/cf /usr/local/bin/compose-farm /usr/local/bin/
|
|
|
|
ENTRYPOINT ["cf"]
|
|
CMD ["--help"]
|