mirror of
https://github.com/MrUnknownDE/docker-nodejs.git
synced 2026-04-20 06:03:44 +02:00
version 1
This commit is contained in:
72
.github/workflows/build-push.yml
vendored
Normal file
72
.github/workflows/build-push.yml
vendored
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
name: Build & Push Electron-Builder Windows Images
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "main" ]
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
workflow_dispatch: {}
|
||||||
|
|
||||||
|
env:
|
||||||
|
IMAGE_NAME: mrunknownde/electron-builder-windows
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- dockerfile: Dockerfile.node20
|
||||||
|
short_tag: node20
|
||||||
|
latest: "true"
|
||||||
|
- dockerfile: Dockerfile.node18
|
||||||
|
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 }}
|
||||||
|
# Optional: also tag by git sha for traceability
|
||||||
|
type=sha,format=long,prefix=${{ matrix.short_tag }}-
|
||||||
|
labels: |
|
||||||
|
org.opencontainers.image.title=electron-builder-windows
|
||||||
|
org.opencontainers.image.source=${{ github.repositoryUrl }}
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./${{ matrix.dockerfile }}
|
||||||
|
platforms: linux/amd64
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
|
# Optionally mark Node20 as "latest"
|
||||||
|
- 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 }}
|
||||||
40
Dockerfile.node18
Normal file
40
Dockerfile.node18
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
# Build image for Electron Windows builds (Node 18)
|
||||||
|
FROM debian:bookworm-slim
|
||||||
|
|
||||||
|
LABEL org.opencontainers.image.title="electron-builder-windows (Node 18)"
|
||||||
|
LABEL org.opencontainers.image.source="https://github.com/MrUnknownDE/docker-nodejs-win"
|
||||||
|
LABEL org.opencontainers.image.description="Linux container for building Windows Electron apps using electron-builder (Node 18)"
|
||||||
|
LABEL maintainer="<you@example.com>"
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive \
|
||||||
|
WINEDEBUG=-all \
|
||||||
|
WINEDLLOVERRIDES="winemenubuilder.exe=d" \
|
||||||
|
NPM_CONFIG_LOGLEVEL=warn
|
||||||
|
|
||||||
|
# 1) Basis-Tools + NodeSource prerequisites
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
ca-certificates curl gnupg2 dirmngr \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# 2) Node.js 18 via NodeSource
|
||||||
|
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/*
|
||||||
|
|
||||||
|
# 3) 32-bit Arch für wine32 + alle Build-Dependencies
|
||||||
|
RUN dpkg --add-architecture i386 \
|
||||||
|
&& apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
build-essential python3 git file xz-utils zip p7zip-full fakeroot \
|
||||||
|
icnsutils graphicsmagick rpm \
|
||||||
|
g++-mingw-w64 nsis osslsigncode \
|
||||||
|
wine32 wine64 mono-complete \
|
||||||
|
xvfb fontconfig \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN node -v && npm -v && npx --yes electron-builder --version || true \
|
||||||
|
&& wine --version && mono --version && makensis -VERSION
|
||||||
|
|
||||||
|
WORKDIR /workspace
|
||||||
|
CMD [ "bash" ]
|
||||||
54
Dockerfile.node20
Normal file
54
Dockerfile.node20
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
FROM debian:bookworm-slim
|
||||||
|
|
||||||
|
LABEL org.opencontainers.image.title="electron-builder-windows (Node 20)"
|
||||||
|
LABEL org.opencontainers.image.source="https://github.com/MrUnknownDE/docker-nodejs-win"
|
||||||
|
LABEL org.opencontainers.image.description="Linux container for building Windows Electron apps using electron-builder (Node 20)"
|
||||||
|
LABEL maintainer="<you@example.com>"
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive \
|
||||||
|
WINEDEBUG=-all \
|
||||||
|
WINEDLLOVERRIDES="winemenubuilder.exe=d" \
|
||||||
|
# reduce noisy npm logs and enable corepack
|
||||||
|
NPM_CONFIG_LOGLEVEL=warn
|
||||||
|
|
||||||
|
# 1) Basis-Tools + NodeSource prerequisites
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
ca-certificates curl gnupg2 dirmngr \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# 2) Node.js 20 via NodeSource
|
||||||
|
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/*
|
||||||
|
|
||||||
|
# 3) 32-bit Arch für wine32 + alle Build-Dependencies
|
||||||
|
RUN dpkg --add-architecture i386 \
|
||||||
|
&& apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
# Build basics
|
||||||
|
build-essential python3 git file xz-utils zip p7zip-full fakeroot \
|
||||||
|
# electron-builder extras
|
||||||
|
icnsutils graphicsmagick rpm \
|
||||||
|
# Windows / signing toolchain
|
||||||
|
g++-mingw-w64 nsis osslsigncode \
|
||||||
|
# Wine & Mono
|
||||||
|
wine32 wine64 mono-complete \
|
||||||
|
# headless
|
||||||
|
xvfb fontconfig \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Optional: häufig genutzte global Tools (pnpm/yarn via corepack)
|
||||||
|
# (corepack ist bereits enabled; Projekte können `packageManager` in package.json definieren)
|
||||||
|
|
||||||
|
# Sanity check: Versionen
|
||||||
|
RUN node -v && npm -v && npx --yes electron-builder --version || true \
|
||||||
|
&& wine --version && mono --version && makensis -VERSION
|
||||||
|
|
||||||
|
# Default Arbeitsverzeichnis
|
||||||
|
WORKDIR /workspace
|
||||||
|
|
||||||
|
# Hinweis: zum Bauen im CI:
|
||||||
|
# - bind-mount/checkout dein Projekt nach /workspace
|
||||||
|
# - npm ci && npm run dist -- --win
|
||||||
|
CMD [ "bash" ]
|
||||||
Reference in New Issue
Block a user