diff --git a/.github/workflows/build-pocketbase.yml b/.github/workflows/build-pocketbase-amd64.yml similarity index 87% rename from .github/workflows/build-pocketbase.yml rename to .github/workflows/build-pocketbase-amd64.yml index f9e2ce2..170d934 100644 --- a/.github/workflows/build-pocketbase.yml +++ b/.github/workflows/build-pocketbase-amd64.yml @@ -28,7 +28,7 @@ jobs: images: docker.io/${{ vars.DOCKERHUB_USERNAME }}/pocketbase tags: | type=raw,value=latest - type=raw,value=build-${{ github.run_number }} + type=raw.value=${{ PB_VERSION }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -39,3 +39,6 @@ jobs: tags: ${{ steps.meta.outputs.tags }} platforms: linux/amd64 push: true + build-args: | + ARCH=${{ vars.AMD64 }} + PB_VERSION=${{ vars.PB_VERSION }} diff --git a/.github/workflows/build-pocketbase-arm64.yml b/.github/workflows/build-pocketbase-arm64.yml new file mode 100644 index 0000000..2628caa --- /dev/null +++ b/.github/workflows/build-pocketbase-arm64.yml @@ -0,0 +1,44 @@ +name: Build Pocketbase +on: + pull_request: + branches: + - production + types: + - closed +jobs: + if_merged: + if: github.event.pull_request.merged == true + name: Build Pocketbase and Push + runs-on: ubuntu-24.04-arm + steps: + - + name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ vars.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - + name: Container Metadata + uses: docker/metadata-action@v5 + id: meta + with: + images: docker.io/${{ vars.DOCKERHUB_USERNAME }}/pocketbase + tags: | + type=raw,value=latest + type=raw.value=${{ PB_VERSION }} + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - + name: Build and Push + uses: docker/build-push-action@v6 + with: + tags: ${{ steps.meta.outputs.tags }} + platforms: linux/arm64 + push: true + build-args: | + ARCH=${{ vars.ARM64 }} + PB_VERSION=${{ vars.PB_VERSION }} diff --git a/Dockerfile b/Dockerfile index 0c9bc8e..a17ef8c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,14 @@ FROM alpine:latest ARG PB_VERSION=0.29.2 +ARG ARCH=amd64 RUN apk add --no-cache \ unzip \ ca-certificates # download and unzip PocketBase x86 64-bit -ADD https://github.com/pocketbase/pocketbase/releases/download/v${PB_VERSION}/pocketbase_${PB_VERSION}_linux_amd64.zip /tmp/pb.zip +ADD https://github.com/pocketbase/pocketbase/releases/download/v${PB_VERSION}/pocketbase_${PB_VERSION}_linux_${ARCH}.zip /tmp/pb.zip RUN unzip /tmp/pb.zip -d /pb/ # uncomment to copy the local pb_migrations dir into the image diff --git a/docker-compose.yml b/docker-compose.yml index e5b6679..232e806 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,10 +1,7 @@ services: pocketbase: container_name: pocketbase - build: - context: . - dockerfile: Dockerfile - image: codefallacy-pocketbase + image: azatecas/pocketbase restart: unless-stopped environment: ENCRYPTION: ${ENCRYPTION} # optional (Ensure this is a 32-character long encryption key https://pocketbase.io/docs/going-to-production/#enable-settings-encryption)