# Base image for Linux CocoaPods dependency resolution
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
# Install system dependencies and Ruby (required for CocoaPods)
RUN apt-get update && \
apt-get install -y --no-install-recommends \
software-properties-common curl ca-certificates build-essential zlib1g-dev ruby-full git && \
rm -rf /var/lib/apt/lists/*
# Install a modern CocoaPods version to avoid legacy issues
RUN gem install cocoapods -v 1.15.2
# Create a non-root user to run the build
RUN useradd -m -u 1000 -s /bin/bash builder
WORKDIR /home/builder/project
# Copy the repository contents (owned by builder to avoid permission issues)
COPY --chown=builder:builder . /home/builder/project
# Ensure the target user owns the project files
RUN chown -R builder:builder /home/builder/project
USER builder
ENV PATH=/usr/local/bin:/usr/bin:/bin:$PATH
# Artifacts directory for build outputs
RUN mkdir -p /home/builder/artifacts
# Step: Run CocoaPods install for the Example project to resolve dependencies using the existing Podfile.lock/Pods
WORKDIR /home/builder/project/Example
RUN pod install || true
# Step: Package the Example project (including Pods) into a tarball for downstream CI or inspection
WORKDIR /home/builder/project
RUN tar czf /home/builder/artifacts/tsmessages-src-with-pods.tar.gz -C /home/builder/project Example
# Indicate a build-like state by creating a marker file
RUN echo BUILD_OK > /home/builder/artifacts/BUILD_OK
CMD ["bash"]