chore: make some cleanups #57
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 | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| env: | |
| REGISTRY: ghcr.io | |
| jobs: | |
| changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| server: ${{ steps.filter.outputs.server }} | |
| inference: ${{ steps.filter.outputs.inference }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dorny/paths-filter@v3 | |
| id: filter | |
| with: | |
| filters: | | |
| server: | |
| - 'client/**' | |
| - 'server/**' | |
| - 'db/**' | |
| - 'docker/Dockerfile' | |
| - 'docker/nginx.conf' | |
| - 'docker/supervisord.conf' | |
| - 'docker/entrypoint.sh' | |
| inference: | |
| - 'inference/**' | |
| - 'docker/Dockerfile.inference' | |
| build-server: | |
| name: Build server image | |
| needs: changes | |
| if: needs.changes.outputs.server == 'true' || github.event_name == 'workflow_dispatch' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Build | |
| env: | |
| VITE_PB_URL: __VITE_PB_URL_PLACEHOLDER__ | |
| VITE_SERVER_URL: __VITE_SERVER_URL_PLACEHOLDER__ | |
| run: bunx turbo run build --filter='!@sirene/desktop' --filter='!@sirene/inference' | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ github.repository }} | |
| tags: | | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=sha | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./docker/Dockerfile | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| platforms: linux/amd64,linux/arm64 | |
| cache-from: type=gha,scope=server | |
| cache-to: type=gha,mode=max,scope=server | |
| build-inference: | |
| name: Build inference image (${{ matrix.variant }}) | |
| needs: changes | |
| if: needs.changes.outputs.inference == 'true' || github.event_name == 'workflow_dispatch' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| strategy: | |
| matrix: | |
| include: | |
| - variant: cpu | |
| tag: latest | |
| - variant: cuda | |
| tag: cuda | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/sirene-inference | |
| tags: | | |
| type=raw,value=${{ matrix.tag }},enable={{is_default_branch}} | |
| type=semver,pattern={{version}},suffix=-${{ matrix.variant }} | |
| type=sha,suffix=-${{ matrix.variant }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./docker/Dockerfile.inference | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| platforms: linux/amd64 | |
| build-args: INFERENCE_VARIANT=${{ matrix.variant }} | |
| cache-from: type=gha,scope=inference-${{ matrix.variant }} | |
| cache-to: type=gha,mode=max,scope=inference-${{ matrix.variant }} |