diff --git a/.github/workflows/build-push-linux.yml b/.github/workflows/build-push-linux.yml new file mode 100644 index 0000000..a2ac016 --- /dev/null +++ b/.github/workflows/build-push-linux.yml @@ -0,0 +1,70 @@ +name: Build & Push Electron-Builder Linux Images + +on: + push: + branches: [ "main" ] + tags: + - "v*" + workflow_dispatch: {} + +env: + IMAGE_NAME: mrunknownde/electron-builder-linux + +jobs: + build-and-push: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - dockerfile: Dockerfile.node20-linux + short_tag: node20 + latest: "true" + - dockerfile: Dockerfile.node18-linux + short_tag: node18 + latest: "false" + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE_NAME }} + tags: | + type=raw,value=${{ matrix.short_tag }} + type=sha,format=long,prefix=${{ matrix.short_tag }}- + labels: | + org.opencontainers.image.title=electron-builder-linux + org.opencontainers.image.source=${{ github.repositoryUrl }} + + - name: Build and push (multi-arch) + uses: docker/build-push-action@v6 + with: + context: . + file: ./${{ matrix.dockerfile }} + # Linux-Build-Container kann gut multi-arch sein + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Also push :latest (only for Node 20) + if: ${{ matrix.latest == 'true' }} + run: | + docker buildx imagetools create \ + --tag ${{ env.IMAGE_NAME }}:latest \ + ${{ env.IMAGE_NAME }}:${{ matrix.short_tag }} diff --git a/Dockerfile.node18-linux b/Dockerfile.node18-linux new file mode 100644 index 0000000..e0f32c3 --- /dev/null +++ b/Dockerfile.node18-linux @@ -0,0 +1,34 @@ +# Electron Linux build image (Node 18) on Debian slim +FROM debian:bookworm-slim + +LABEL org.opencontainers.image.title="electron-builder-linux (Node 18)" +LABEL org.opencontainers.image.description="Container for building Linux Electron apps (AppImage, deb, rpm) using electron-builder (Node 18)" +LABEL maintainer="me@johanneskr.de" + +ENV DEBIAN_FRONTEND=noninteractive \ + NPM_CONFIG_LOGLEVEL=warn + +# 1) Basis & Node 18 via NodeSource +RUN apt-get update && apt-get install -y --no-install-recommends \ + ca-certificates curl gnupg2 dirmngr \ + && rm -rf /var/lib/apt/lists/* + +RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \ + && apt-get update && apt-get install -y --no-install-recommends nodejs \ + && corepack enable \ + && rm -rf /var/lib/apt/lists/* + +# 2) Build- & Packaging-Deps (wie oben) +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential python3 git file xz-utils zip p7zip-full fakeroot \ + dpkg rpm libarchive-tools \ + libfuse2 \ + pkg-config libudev-dev libusb-1.0-0-dev libsecret-1-dev \ + xvfb fontconfig \ + libx11-xcb1 libxss1 libasound2 libnss3 libgtk-3-0 libatk-bridge2.0-0 libgbm1 libxkbcommon0 libdrm2 \ + && rm -rf /var/lib/apt/lists/* + +RUN node -v && npm -v && npx --yes electron-builder --version || true + +WORKDIR /workspace +CMD ["bash"] diff --git a/Dockerfile.node20-linux b/Dockerfile.node20-linux new file mode 100644 index 0000000..67a40d2 --- /dev/null +++ b/Dockerfile.node20-linux @@ -0,0 +1,40 @@ +# Electron Linux build image (Node 20) on Debian slim +FROM debian:bookworm-slim + +LABEL org.opencontainers.image.title="electron-builder-linux (Node 20)" +LABEL org.opencontainers.image.description="Container for building Linux Electron apps (AppImage, deb, rpm) using electron-builder (Node 20)" +LABEL maintainer="me@johanneskr.de" + +ENV DEBIAN_FRONTEND=noninteractive \ + NPM_CONFIG_LOGLEVEL=warn + +# 1) Basis & Node 20 via NodeSource +RUN apt-get update && apt-get install -y --no-install-recommends \ + ca-certificates curl gnupg2 dirmngr \ + && rm -rf /var/lib/apt/lists/* + +RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ + && apt-get update && apt-get install -y --no-install-recommends nodejs \ + && corepack enable \ + && rm -rf /var/lib/apt/lists/* + +# 2) Build- & Packaging-Deps (für electron-builder Linux Targets) +# - AppImage benötigt FUSE -> libfuse2 +# - deb: dpkg, fakeroot +# - rpm: rpm +# - native modules: build-essential, python3, pkg-config, libudev-dev, libusb-1.0-0-dev, libsecret-1-dev +# - optional runtime libs für Tests/Headless-Runs +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential python3 git file xz-utils zip p7zip-full fakeroot \ + dpkg rpm libarchive-tools \ + libfuse2 \ + pkg-config libudev-dev libusb-1.0-0-dev libsecret-1-dev \ + xvfb fontconfig \ + libx11-xcb1 libxss1 libasound2 libnss3 libgtk-3-0 libatk-bridge2.0-0 libgbm1 libxkbcommon0 libdrm2 \ + && rm -rf /var/lib/apt/lists/* + +# (Optional) Sanity-Check +RUN node -v && npm -v && npx --yes electron-builder --version || true + +WORKDIR /workspace +CMD ["bash"]