From 3070a124a8191b4f1c14b1fdc294f8621cf2879e Mon Sep 17 00:00:00 2001 From: LPM Date: Tue, 12 Aug 2025 23:43:07 -0400 Subject: [PATCH] updated workflow to build multiarch, updated description --- .github/workflows/build-pocketbase-amd64.yml | 6 ++- .github/workflows/build-pocketbase-arm64.yml | 43 -------------------- Dockerfile | 15 ++++++- README.md | 28 ++++++++++++- docker-compose.yml | 18 -------- 5 files changed, 45 insertions(+), 65 deletions(-) delete mode 100644 .github/workflows/build-pocketbase-arm64.yml delete mode 100644 docker-compose.yml diff --git a/.github/workflows/build-pocketbase-amd64.yml b/.github/workflows/build-pocketbase-amd64.yml index e862b8a..a1fda13 100644 --- a/.github/workflows/build-pocketbase-amd64.yml +++ b/.github/workflows/build-pocketbase-amd64.yml @@ -27,7 +27,9 @@ jobs: with: images: docker.io/${{ vars.DOCKERHUB_USERNAME }}/pocketbase tags: | - type=raw,value=${{ vars.PB_VERSION }}-${{ vars.AMD64 }} + type=raw,value=build-${{ github.run_number }} + type=raw,value=${{ vars.PB_VERSION }} + type=raw,value=latest - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -36,7 +38,7 @@ jobs: uses: docker/build-push-action@v6 with: tags: ${{ steps.meta.outputs.tags }} - platforms: linux/amd64 + platforms: linux/amd64,linux/arm64 push: true build-args: | ARCH=${{ vars.AMD64 }} diff --git a/.github/workflows/build-pocketbase-arm64.yml b/.github/workflows/build-pocketbase-arm64.yml deleted file mode 100644 index c57bf93..0000000 --- a/.github/workflows/build-pocketbase-arm64.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Build Pocketbase -on: - pull_request: - branches: - - production - types: - - closed -jobs: - if_merged: - if: github.event.pull_request.merged == true - name: Build Pocketbase ARM64 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=${{ vars.PB_VERSION }}-${{ vars.ARM64 }} - - - 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 a17ef8c..a95f51d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,20 @@ FROM alpine:latest ARG PB_VERSION=0.29.2 -ARG ARCH=amd64 + +ARG TARGETARCH + +# Set ARCH from TARGETARCH (default to amd64) +# Pocketbase uses "amd64" or "arm64" in their asset names +ARG ARCH +RUN if [ -z "$ARCH" ]; then \ + case "$TARGETARCH" in \ + amd64) export ARCH=amd64 ;; \ + arm64) export ARCH=arm64 ;; \ + *) echo "Unsupported arch: $TARGETARCH" && exit 1 ;; \ + esac && \ + echo "Detected ARCH=$ARCH"; \ + fi RUN apk add --no-cache \ unzip \ diff --git a/README.md b/README.md index 3ea110e..4e2629d 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,29 @@ ### Dockerized Pocketbase -This is my attempt at dockerizing pocketbase for linux/amd64 +Unoffical Pocketbase Docker Container + +This Repo sets up the Github Actions to build and deploy to Dockerhub the `azatecas/pocketbase` image. +I do not build pocketbase from scratch, but rather pull the official release from the original Pocketbase Repo and containarize it. + +Suggested `docker-compose.yml` configuration + +```yml +services: + pocketbase: + container_name: 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) + ports: + - "127.0.0.1:8080:8080" + volumes: + - ${COMMON_PATH}/pb_data:/pb/pb_data + - ${COMMON_PATH}/pb_public:/pb/pb_public # optional + - ${COMMON_PATH}/pb_hooks:/pb/pb_hooks # optional + healthcheck: # optional, recommended since v0.10.0 + test: wget --no-verbose --tries=1 --spider http://localhost:8080/api/health || exit 1 + interval: 60s + timeout: 5s + retries: 5 +``` diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 232e806..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,18 +0,0 @@ -services: - pocketbase: - container_name: 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) - ports: - - "127.0.0.1:8080:8080" - volumes: - - ${COMMON_PATH}/pb_data:/pb/pb_data - - ${COMMON_PATH}/pb_public:/pb/pb_public # optional - - ${COMMON_PATH}/pb_hooks:/pb/pb_hooks # optional - healthcheck: # optional, recommended since v0.10.0 - test: wget --no-verbose --tries=1 --spider http://localhost:8080/api/health || exit 1 - interval: 60s - timeout: 5s - retries: 5