Files
deltaglider/Dockerfile
Simone Scarduzio 7562064832 Initial commit: DeltaGlider - 99.9% compression for S3 storage
DeltaGlider reduces storage costs by storing only binary deltas between
similar files. Achieves 99.9% compression for versioned artifacts.

Key features:
- Intelligent file type detection (delta for archives, direct for others)
- Drop-in S3 replacement with automatic compression
- SHA256 integrity verification on every operation
- Clean hexagonal architecture
- Full test coverage
- Production tested with 200K+ files

Case study: ReadOnlyREST reduced 4TB to 5GB (99.9% compression)
2025-09-22 15:49:31 +02:00

68 lines
2.0 KiB
Docker

# Multi-stage build for deltaglider
ARG PYTHON_VERSION=3.12-slim
ARG UV_VERSION=0.5.13
# Builder stage - install UV and dependencies
FROM ghcr.io/astral-sh/uv:$UV_VERSION AS uv
FROM python:${PYTHON_VERSION} AS builder
# Copy UV from the UV image
COPY --from=uv /uv /usr/local/bin/uv
ENV UV_SYSTEM_PYTHON=1
WORKDIR /build
# Copy dependency files first for better caching
COPY pyproject.toml ./
COPY README.md ./
# Install dependencies with UV caching
RUN --mount=type=cache,target=/root/.cache/uv \
uv pip install --compile-bytecode .
# Copy source code
COPY src ./src
# Install the package (force reinstall to ensure it's properly installed)
RUN --mount=type=cache,target=/root/.cache/uv \
uv pip install --compile-bytecode --no-deps --force-reinstall .
# Runtime stage - minimal image
FROM python:${PYTHON_VERSION}
# Install xdelta3
RUN apt-get update && \
apt-get install -y --no-install-recommends xdelta3 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN useradd -m -u 1000 -s /bin/bash deltaglider
# Copy installed packages from builder
COPY --from=builder /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
COPY --from=builder /usr/local/bin/deltaglider /usr/local/bin/deltaglider
# Set up working directory
WORKDIR /app
RUN chown -R deltaglider:deltaglider /app
# Create cache directory with proper permissions
RUN mkdir -p /tmp/.deltaglider && \
chown -R deltaglider:deltaglider /tmp/.deltaglider
USER deltaglider
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD deltaglider --help || exit 1
# Labels
LABEL org.opencontainers.image.title="DeltaGlider" \
org.opencontainers.image.description="Delta-aware S3 file storage wrapper" \
org.opencontainers.image.version="0.1.0" \
org.opencontainers.image.authors="Beshu Limited" \
org.opencontainers.image.source="https://github.com/beshu-tech/deltaglider"
ENTRYPOINT ["deltaglider"]
CMD ["--help"]