From 0c1f1cc796a546e77b72d87f098defc0ca3c6d8c Mon Sep 17 00:00:00 2001 From: David Lynch Date: Fri, 21 Aug 2026 14:23:05 +0100 Subject: [PATCH] feat(ENG-14032): adding container image build to CI --- .editorconfig | 2 +- .github/workflows/image-build.yml | 27 +++++++++++++++++++ dev.Dockerfile | 45 +++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/image-build.yml create mode 100644 dev.Dockerfile diff --git a/.editorconfig b/.editorconfig index 057c2340..3d7bdfdc 100644 --- a/.editorconfig +++ b/.editorconfig @@ -11,5 +11,5 @@ quote_type = double max_line_length = 88 trim_trailing_whitespace = true -[site.yaml] +[{*.yaml,*.yml,*.kyaml}] indent_size = 2 diff --git a/.github/workflows/image-build.yml b/.github/workflows/image-build.yml new file mode 100644 index 00000000..c6ad076b --- /dev/null +++ b/.github/workflows/image-build.yml @@ -0,0 +1,27 @@ +name: Container Image Build +on: + push: + branches: + - master + pull_request: + branches: + - "**" +permissions: + contents: read +jobs: + image-build: + name: Build container image + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + with: + persist-credentials: false + - name: Build image + run: | + docker build -t cloudsmith-io/cli-dev \ + --file dev.Dockerfile \ + --build-arg CLOUDSMITH_CLI_VERSION="$(cat VERSION)" \ + --build-arg VCS_REF="${GITHUB_SHA}" \ + . + - name: Test image + run: docker run -t cloudsmith-io/cli-dev --help diff --git a/dev.Dockerfile b/dev.Dockerfile new file mode 100644 index 00000000..fec9a942 --- /dev/null +++ b/dev.Dockerfile @@ -0,0 +1,45 @@ +ARG ALPINE_IMAGE=alpine:3.21@sha256:48b0309ca019d89d40f670aa1bc06e426dc0931948452e8491e3d65087abc07d + +FROM astral/uv:alpine AS build + +WORKDIR /root/cloudsmith-cli + +RUN apk add --no-cache binutils + +ADD bin bin +ADD cloudsmith_cli cloudsmith_cli +ADD packaging packaging +ADD pyproject.toml pyproject.toml +ADD uv.lock uv.lock +ADD VERSION VERSION + +ARG CLOUDSMITH_CLI_VERSION +ARG PYTHON_VERSION=3.14 + +RUN uv sync --locked --no-dev --no-editable --group binary --extra all --python "${PYTHON_VERSION}" +RUN uv run --no-sync pyinstaller --clean --noconfirm packaging/pyinstaller/cloudsmith.spec + +FROM ${ALPINE_IMAGE} + +COPY --from=build /root/cloudsmith-cli/dist/cloudsmith /opt/cloudsmith + +ARG CLOUDSMITH_CLI_VERSION +ARG VCS_REF + +LABEL maintainer="support@cloudsmith.io" \ + org.opencontainers.image.title="Cloudsmith CLI" \ + org.opencontainers.image.description="Official Cloudsmith CLI" \ + org.opencontainers.image.vendor="Cloudsmith" \ + org.opencontainers.image.url="https://cloudsmith.com" \ + org.opencontainers.image.source="https://github.com/cloudsmith-io/cloudsmith-cli" \ + org.opencontainers.image.documentation="https://docs.cloudsmith.com/developer-tools/cli" \ + org.opencontainers.image.licenses="Apache-2.0" \ + org.opencontainers.image.version="${CLOUDSMITH_CLI_VERSION}" \ + org.opencontainers.image.revision="${VCS_REF}" + +ENV PATH="/opt/cloudsmith:${PATH}" + +RUN adduser -D -u 1000 cloudsmith +USER cloudsmith + +ENTRYPOINT ["cloudsmith"]