hyperoslo-imagepicker
SUCCESS
20m 33s
History Source
SummaryIterations2Transcript26Dockerfile
Dockerfile43 lines · 1117 chars
# Multi-stage build for ImagePicker SwiftPM library

# Builder stage: use a full Swift toolchain with Linux support
FROM swift:5.9-jammy AS builder

ARG BUILD_FOR_LINUX=0

WORKDIR /app

# Install system dependencies
RUN apt-get update \
    && apt-get install -y --no-install-recommends \
        git \
        curl \
        ca-certificates \
    && rm -rf /var/lib/apt/lists/*

# Copy source code
COPY . .

# Build the library from source if requested for Linux; otherwise skip (UIKit/macOS-specific)
RUN if [ "${BUILD_FOR_LINUX}" = "1" ]; then \
        swift build -c release \
    ; else \
        echo "Skipping in-container Swift build (UIKit/macOS target)." \
    ; fi

# Runtime stage: keep a lean image with the repository contents
FROM debian:bookworm-slim AS runtime

# Install minimal runtime dependencies
RUN apt-get update \
    && apt-get install -y --no-install-recommends ca-certificates \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Copy the repository contents from the builder (even if not built)
COPY --from=builder /app /app

# Provide an interactive shell by default
CMD ["/bin/bash"]