Skip to content

feat(containers): add docker server image for opencode code server #1

feat(containers): add docker server image for opencode code server

feat(containers): add docker server image for opencode code server #1

Workflow file for this run

name: docker-server

Check failure on line 1 in .github/workflows/docker-server.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/docker-server.yml

Invalid workflow file

(Line: 34, Col: 9): Unrecognized named-value: 'matrix'. Located at position 92 within expression: (github.event_name == 'workflow_dispatch' && (inputs.variant == 'all' || inputs.variant == matrix.variant)) || (github.event_name != 'workflow_dispatch')
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