quick-quick
SUCCESS
62m 33s
History Source
SummaryIterations3Transcript69Dockerfile
Dockerfile52 lines · 1532 chars
# Stage 1: Build a minimal QuickLint executable from source only
FROM swift:jammy AS builder

ENV DEBIAN_FRONTEND=noninteractive

WORKDIR /workspace

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

# Copy only the QuickLint sources from the repository
COPY Sources/QuickLint ./Sources/QuickLint

# Create a minimal Package.swift that builds only the QuickLint executable
RUN cat > Package.swift <<'SWIFT'
// swift-tools-version:5.9
import PackageDescription

let package = Package(
    name: "QuickLintBuild",
    dependencies: [
        .package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.3.1"),
        .package(url: "https://github.com/apple/swift-algorithms.git", from: "1.2.0"),
    ],
    targets: [
        .executableTarget(
            name: "QuickLint",
            dependencies: [
                .product(name: "ArgumentParser", package: "swift-argument-parser"),
                .product(name: "Algorithms", package: "swift-algorithms"),
            ],
            path: "Sources/QuickLint"
        )
    ]
)
SWIFT

# Build the QuickLint executable in release configuration
RUN swift build -c release --product QuickLint

# Stage 2: Runtime image
FROM swift:jammy AS runtime

# Copy the built binary from the builder stage
COPY --from=builder /workspace/.build/release/QuickLint /usr/local/bin/quicklint

RUN chmod +x /usr/local/bin/quicklint

ENTRYPOINT ["/usr/local/bin/quicklint"]