diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml new file mode 100644 index 00000000..43824408 --- /dev/null +++ b/.github/workflows/build-images.yml @@ -0,0 +1,65 @@ +name: Build Self-Host Images + +on: + push: + branches: [main] + tags: ['v*'] + paths: + - 'Dockerfile' + - 'src/ws/**' + - 'package.json' + - 'pnpm-lock.yaml' + - '.github/workflows/build-images.yml' + workflow_dispatch: {} + +permissions: + contents: read + packages: write + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - name: web + context: . + dockerfile: Dockerfile + - name: ws + context: ./src/ws + dockerfile: ./src/ws/Dockerfile + steps: + - name: Checkout + uses: actions/checkout@v4 + + - 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: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository_owner }}/sarge-${{ matrix.name }} + tags: | + type=raw,value=latest,enable={{is_default_branch}} + type=ref,event=tag + type=sha,format=short + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: ${{ matrix.context }} + file: ${{ matrix.dockerfile }} + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha,scope=${{ matrix.name }} + cache-to: type=gha,mode=max,scope=${{ matrix.name }} diff --git a/src/ws/Dockerfile b/src/ws/Dockerfile index 5e4d9eb9..11302ba2 100644 --- a/src/ws/Dockerfile +++ b/src/ws/Dockerfile @@ -2,6 +2,6 @@ FROM node:22-slim WORKDIR /src/ws RUN corepack enable pnpm COPY package.json index.js pnpm-lock.yaml* ./ -RUN pnpm install +RUN pnpm install --allow-build=bufferutil,utf-8-validate CMD ["node", "index.js"]