diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6b901b91..e8660346 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,6 +7,7 @@ on: permissions: contents: write + packages: write jobs: release: @@ -120,3 +121,65 @@ jobs: if: always() run: | rm -rf "${{ steps.signing-keys.outputs.key_dir }}" + + docker: + runs-on: ${{ matrix.runner }} + needs: release + strategy: + matrix: + include: + - runner: ubuntu-latest + platform: linux/amd64 + suffix: amd64 + - runner: ubuntu-24.04-arm + platform: linux/arm64 + suffix: arm64 + permissions: + contents: read + packages: write + steps: + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: https://github.com/${{ github.repository }}.git#${{ github.ref }} + platforms: ${{ matrix.platform }} + push: true + tags: ghcr.io/upsun/cli:${{ github.ref_name }}-${{ matrix.suffix }} + build-args: | + VERSION=${{ github.ref_name }} + cache-from: type=gha,scope=${{ matrix.suffix }} + cache-to: type=gha,mode=max,scope=${{ matrix.suffix }} + + docker-manifest: + runs-on: ubuntu-latest + needs: docker + permissions: + packages: write + steps: + - name: Log in to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create and push manifest + run: | + docker manifest create ghcr.io/upsun/cli:${{ github.ref_name }} \ + ghcr.io/upsun/cli:${{ github.ref_name }}-amd64 \ + ghcr.io/upsun/cli:${{ github.ref_name }}-arm64 + docker manifest push ghcr.io/upsun/cli:${{ github.ref_name }} + docker manifest create ghcr.io/upsun/cli:latest \ + ghcr.io/upsun/cli:${{ github.ref_name }}-amd64 \ + ghcr.io/upsun/cli:${{ github.ref_name }}-arm64 + docker manifest push ghcr.io/upsun/cli:latest diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..03c9404d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM ubuntu:24.04 + +# Install dependencies +RUN apt-get update && \ + apt-get install -y --no-install-recommends curl bash git ssh-client && \ + rm -rf /var/lib/apt/lists/* + +# Install Upsun CLI +ARG VERSION= +RUN curl -fsSL https://raw.githubusercontent.com/upsun/cli/main/installer.sh | INSTALL_METHOD=raw VERSION=$VERSION bash + +# Default command +ENTRYPOINT ["upsun"] diff --git a/README.md b/README.md index 77be0ee1..c43c34d2 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,20 @@ sudo dnf install -y upsun-cli For manual installation, you can also [download the latest binaries](https://github.com/upsun/cli/releases/latest). +### Docker + +The CLI is also available as a Docker image: + +```console +docker run --rm -it ghcr.io/upsun/cli +``` + +To use a specific version: + +```console +docker run --rm -it ghcr.io/upsun/cli:v6.0.0 +``` + ## Upgrade Upgrade using the same tool: @@ -188,6 +202,7 @@ Releases are automated via GitHub Actions. To create a new release: - Sign packages (APK, DEB, RPM) - Create a GitHub release with all artifacts - Update package repositories at repositories.upsun.com + - Build and push Docker image to ghcr.io/upsun/cli ## Licenses