feat(containers): add docker server image for opencode code server #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: docker-server | ||
|
Check failure on line 1 in .github/workflows/docker-server.yml
|
||
| on: | ||
| push: | ||
| branches: | ||
| - dev | ||
| paths: | ||
| - "packages/containers/server/**" | ||
| - ".github/workflows/docker-server.yml" | ||
| release: | ||
| types: [published] | ||
| workflow_dispatch: | ||
| inputs: | ||
| variant: | ||
| type: choice | ||
| options: | ||
| - all | ||
| - debian | ||
| - alpine | ||
| default: all | ||
| description: "Docker image variant to build" | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| env: | ||
| REGISTRY: ghcr.io/${{ github.repository }} | ||
| BUILDKIT_INLINE_CACHE: 1 | ||
| jobs: | ||
| build: | ||
| runs-on: blacksmith-4vcpu-ubuntu-2404 | ||
| if: >- | ||
| (github.event_name == 'workflow_dispatch' && (inputs.variant == 'all' || inputs.variant == matrix.variant)) | ||
| || (github.event_name != 'workflow_dispatch') | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| variant: | ||
| - debian | ||
| - alpine | ||
| include: | ||
| - variant: debian | ||
| dockerfile: Dockerfile.debian | ||
| - variant: alpine | ||
| dockerfile: Dockerfile.alpine | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Setup Bun | ||
| uses: ./.github/actions/setup-bun | ||
| - name: Set up QEMU | ||
| uses: docker/setup-qemu-action@v3 | ||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
| - name: Cache Docker layers | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: /tmp/.buildx-cache | ||
| key: ${{ runner.os }}-buildx-${{ matrix.variant }}-${{ hashFiles('packages/containers/server/docker/**') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-buildx-${{ matrix.variant }}- | ||
| - name: Login to GHCR | ||
| if: github.event_name != 'pull_request' | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ghcr.io | ||
| username: ${{ github.repository_owner }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Determine version tag | ||
| id: version | ||
| run: | | ||
| if [[ "${{ github.event_name }}" == "release" ]]; then | ||
| VERSION="${{ github.ref_name }}" | ||
| else | ||
| VERSION="dev" | ||
| fi | ||
| echo "version=$VERSION" >> $GITHUB_OUTPUT | ||
| echo "Building version: $VERSION" | ||
| - name: Build and push | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: . | ||
| file: packages/containers/server/docker/${{ matrix.dockerfile }} | ||
| platforms: linux/amd64,linux/arm64 | ||
| push: ${{ github.event_name != 'pull_request' }} | ||
| tags: | | ||
| ${{ env.REGISTRY }}:${{ steps.version.outputs.version }}-${{ matrix.variant }} | ||
| ${{ env.REGISTRY }}:latest-${{ matrix.variant }} | ||
| cache-from: type=local,src=/tmp/.buildx-cache | ||
| cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max | ||
| build-args: | | ||
| OPENCODE_VERSION=${{ steps.version.outputs.version }} | ||
| - name: Move cache | ||
| run: | | ||
| rm -rf /tmp/.buildx-cache | ||
| mv /tmp/.buildx-cache-new /tmp/.buildx-cache | ||