diff --git a/.gitea/workflows/build-image.yml b/.gitea/workflows/build-image.yml new file mode 100644 index 0000000..7390369 --- /dev/null +++ b/.gitea/workflows/build-image.yml @@ -0,0 +1,27 @@ +name: Build Docker Image + +on: + workflow_dispatch: + +jobs: + build-and-push-image: + runs-on: build-htz-01 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile.build + platforms: linux/amd64,linux/arm64 + push: true + tags: cr.jdbnet.co.uk/jdbnet/wails-builder:latest diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 7d474d0..3588798 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -21,16 +21,9 @@ jobs: mkdir -p dist # Build Linux amd64 and Windows (amd64 & arm64) binaries - docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace golang:1.26.4-bookworm bash -c " - apt-get update && apt-get install -y curl gcc mingw-w64 libgtk-3-dev libwebkit2gtk-4.1-dev - - # Install Node.js - curl -fsSL https://deb.nodesource.com/setup_22.x | bash - - apt-get install -y nodejs - - # Install Wails CLI - go install github.com/wailsapp/wails/v2/cmd/wails@latest - export PATH=\"\$PATH:\$(go env GOPATH)/bin\" + docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace cr.jdbnet.co.uk/jdbnet/wails-builder:latest bash -c " + # Install frontend dependencies + cd frontend && npm install && cd .. # Linux amd64 wails build -platform linux/amd64 -tags webkit2_41 -clean @@ -48,24 +41,14 @@ jobs: - name: Build Linux ARM64 binary (via QEMU) run: | # Build Linux arm64 binaries (via QEMU) - docker run --rm --platform linux/arm64 -v ${{ github.workspace }}:/workspace -w /workspace golang:1.26.4-bookworm bash -c " - apt-get update && apt-get install -y curl gcc libgtk-3-dev libwebkit2gtk-4.1-dev - - # Install Node.js - curl -fsSL https://deb.nodesource.com/setup_22.x | bash - - apt-get install -y nodejs - + docker run --rm --platform linux/arm64 -v ${{ github.workspace }}:/workspace -w /workspace cr.jdbnet.co.uk/jdbnet/wails-builder:latest bash -c " # Re-install frontend dependencies for arm64 (clears out the amd64 esbuild binary) rm -rf frontend/node_modules cd frontend && npm install && cd .. - # Install Wails CLI - go install github.com/wailsapp/wails/v2/cmd/wails@latest - export PATH=\"\$PATH:\$(go env GOPATH)/bin\" - # Linux arm64 wails build -platform linux/arm64 -tags webkit2_41 -clean - cp build/bin/goexplore-init dist/goexplore-linux-arm64 + cp build/bin/goexplore dist/goexplore-linux-arm64 " - name: Upload to Cloudflare R2 diff --git a/Dockerfile.build b/Dockerfile.build new file mode 100644 index 0000000..cdba756 --- /dev/null +++ b/Dockerfile.build @@ -0,0 +1,22 @@ +FROM golang:1.26.4-bookworm + +# Install required system dependencies for Wails, GTK, WebKit, and MinGW for cross-compiling +RUN apt-get update && apt-get install -y \ + curl \ + gcc \ + mingw-w64 \ + libgtk-3-dev \ + libwebkit2gtk-4.1-dev \ + && rm -rf /var/lib/apt/lists/* + +# Install Node.js 22 +RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \ + && apt-get install -y nodejs \ + && rm -rf /var/lib/apt/lists/* + +# Install Wails CLI +RUN go install github.com/wailsapp/wails/v2/cmd/wails@latest + +ENV PATH="$PATH:/go/bin" + +WORKDIR /workspace