FROM swift:6.2
# Build and runtime container for SwiftProtobuf project
# This container builds the project from source using the provided Makefile.
# It installs necessary system dependencies (git, make, g++, etc.), fetches
# the repository (including submodules), builds via `make build`, and leaves
# an interactive shell as CMD.
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
git \
make \
g++ \
cmake \
pkg-config \
libssl-dev \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Working directory for the repository
WORKDIR /workspace
# Clean workspace in case any previous content exists
RUN rm -rf /workspace/* || true
# Clone the repository including submodules
# This ensures all generated sources (e.g., protoc, SwiftProtobuf plugin) are present
RUN git clone --depth 1 --recursive https://github.com/apple/swift-protobuf.git /workspace
# Build the project from source using the repository's Makefile
RUN make build
# Default to an interactive shell when the container runs
CMD ["/bin/bash"]