minimize Docker-Win

This commit is contained in:
2025-08-13 23:02:46 +02:00
parent 3797aa15f4
commit b2111f3c74
2 changed files with 55 additions and 94 deletions

View File

@@ -1,49 +1,34 @@
# Build image for Electron Windows builds (Node 18) FROM ubuntu:22.04
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 \ 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 \ RUN dpkg --add-architecture i386 \
&& apt-get update && apt-get install -y --no-install-recommends \ && apt-get update \
# Build basics && apt-get install -y --no-install-recommends \
build-essential python3 git file xz-utils zip p7zip-full fakeroot \ ca-certificates curl gnupg \
# electron-builder extras && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
icnsutils graphicsmagick rpm \ && NODE_MAJOR=18 \
# Windows / signing toolchain && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
g++-mingw-w64 nsis osslsigncode \ && apt-get update \
# Wine & Mono (wichtig: 'wine' Metapackage dazu!) && apt-get install -y nodejs \
wine wine32 wine64 mono-complete winbind cabextract \ # Wine & Mono
# headless && apt-get install -y --no-install-recommends \
xvfb fontconfig \ wine wine32 wine64 mono-complete winbind cabextract \
&& rm -rf /var/lib/apt/lists/* # AWS CLI
awscli \
# Other build essentials
build-essential python3 git file xz-utils zip p7zip-full fakeroot \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN node -v \ # Set up a working directory
&& npm -v \ WORKDIR /project
&& npx --yes electron-builder --version || true \
&& (command -v wine >/dev/null && wine --version || wine64 --version) \
&& mono --version \
&& makensis -VERSION
WORKDIR /workspace # (Optional) Install electron-builder globally in the image
CMD [ "bash" ] # This can sometimes help with pathing issues, but isn't strictly necessary
# if it's in the project's devDependencies.
RUN npm install -g electron-builder
# Set the entrypoint to bash
ENTRYPOINT ["/bin/bash"]

View File

@@ -1,58 +1,34 @@
FROM debian:bookworm-slim FROM ubuntu:22.04
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 \ 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 \ RUN dpkg --add-architecture i386 \
&& apt-get update && apt-get install -y --no-install-recommends \ && apt-get update \
# Build basics && apt-get install -y --no-install-recommends \
build-essential python3 git file xz-utils zip p7zip-full fakeroot \ ca-certificates curl gnupg \
# electron-builder extras && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
icnsutils graphicsmagick rpm \ && NODE_MAJOR=20 \
# Windows / signing toolchain && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
g++-mingw-w64 nsis osslsigncode \ && apt-get update \
# Wine & Mono (wichtig: 'wine' Metapackage dazu!) && apt-get install -y nodejs \
wine wine32 wine64 mono-complete winbind cabextract \ # Wine & Mono
# headless && apt-get install -y --no-install-recommends \
xvfb fontconfig \ wine wine32 wine64 mono-complete winbind cabextract \
&& rm -rf /var/lib/apt/lists/* # AWS CLI
awscli \
# Other build essentials
build-essential python3 git file xz-utils zip p7zip-full fakeroot \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Optional: häufig genutzte global Tools (pnpm/yarn via corepack) # Set up a working directory
# (corepack ist bereits enabled; Projekte können `packageManager` in package.json definieren) WORKDIR /project
# Sanity check: Versionen # (Optional) Install electron-builder globally in the image
RUN node -v \ # This can sometimes help with pathing issues, but isn't strictly necessary
&& npm -v \ # if it's in the project's devDependencies.
&& npx --yes electron-builder --version || true \ RUN npm install -g electron-builder
&& (command -v wine >/dev/null && wine --version || wine64 --version) \
&& mono --version \
&& makensis -VERSION
# Default Arbeitsverzeichnis # Set the entrypoint to bash
WORKDIR /workspace ENTRYPOINT ["/bin/bash"]
# Hinweis: zum Bauen im CI:
# - bind-mount/checkout dein Projekt nach /workspace
# - npm ci && npm run dist -- --win
CMD [ "bash" ]