Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ quote_type = double
max_line_length = 88
trim_trailing_whitespace = true

[site.yaml]
[{*.yaml,*.yml,*.kyaml}]
indent_size = 2
25 changes: 25 additions & 0 deletions .github/workflows/image-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
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 compose build \
--build-arg CLOUDSMITH_CLI_VERSION="$(cat VERSION)" \
--build-arg VCS_REF="${GITHUB_SHA}"
- name: Test image
run: docker compose run cli
24 changes: 0 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -452,24 +452,6 @@ jobs:
with:
persist-credentials: false

- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: cloudsmith-linux-*-musl
merge-multiple: true
path: binaries

- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: cloudsmith-linux-x86_64-gnu
merge-multiple: true
path: binaries

- name: Set up the built cloudsmith binary on the runner
uses: ./.github/actions/setup-cloudsmith-binary
with:
version: ${{ needs.validate.outputs.version }}
add-local-bin: "true"

- uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4.1.0

- uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
Expand All @@ -494,12 +476,6 @@ jobs:
- name: Build once and push the same image to both registries
run: |
set -euo pipefail
AMD64="binaries/cloudsmith-${VERSION}-linux-x86_64-musl.tar.gz"
ARM64="binaries/cloudsmith-${VERSION}-linux-aarch64-musl.tar.gz"
test -f "${AMD64}"
test -f "${AMD64}.sha256"
test -f "${ARM64}"
test -f "${ARM64}.sha256"

# Immutable Cloudsmith repo: push the tag only if absent (inspect runs
# post-auth, so non-zero = not present). Docker Hub is mutable.
Expand Down
52 changes: 26 additions & 26 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
ARG ALPINE_IMAGE=alpine:3.21@sha256:48b0309ca019d89d40f670aa1bc06e426dc0931948452e8491e3d65087abc07d

FROM ${ALPINE_IMAGE} AS unpack
FROM astral/uv:alpine AS build

ARG TARGETARCH
ARG CLOUDSMITH_CLI_VERSION
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

COPY binaries/ /tmp/binaries/
ARG CLOUDSMITH_CLI_VERSION
ARG PYTHON_VERSION=3.14

RUN set -eu; \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we still maintain the multi-architecture images by changing this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can add a matrix to build it for amd64 and aarch64 if needed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more the merrier 😛 our release workflow pushes the docker image to cloudsmith and dockerhub

case "${TARGETARCH}" in \
amd64) CS_ARCH="x86_64" ;; \
arm64) CS_ARCH="aarch64" ;; \
*) echo "Unsupported architecture: ${TARGETARCH}" >&2; exit 1 ;; \
esac; \
ARCHIVE="cloudsmith-${CLOUDSMITH_CLI_VERSION}-linux-${CS_ARCH}-musl.tar.gz"; \
cd /tmp/binaries; \
sha256sum -c "${ARCHIVE}.sha256"; \
mkdir -p /opt; \
tar -xzf "${ARCHIVE}" -C /opt
RUN uv sync --locked --no-dev --no-editable --group binary --extra all --python "${PYTHON_VERSION}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

previously we had no python or uv dependency due to just dropping in the standalone binary that takes care of all those concerns.

@coillteoir coillteoir Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The final image in this build only contains the standalone binary.

It is ideal to build container images from source, since it means builds are more declarative (docker isn't a declarative build format since it calls out to the internet, but its better than copying from local directories.)

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}"
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}"

COPY --from=unpack /opt/cloudsmith /opt/cloudsmith

RUN adduser -D -u 1000 cloudsmith
USER cloudsmith

Expand Down
5 changes: 5 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
services:
cli:
image: cloudsmith-cli
build:
context: .
Loading