Skip to content

Commit

Permalink
feat(docker): smaller docker images
Browse files Browse the repository at this point in the history
* `electronuserland/electron-builder:8` renamed to `electronuserland/builder:8`. 413 MB vs 286 MB.
* `electronuserland/electron-builder:6` renamed to `electronuserland/builder:6`. 407 MB vs 282 MB.
* `electronuserland/electron-builder:wine` renamed to `electronuserland/builder:wine`. 543 MB vs 380 MB. Please note — Mono was extracted to separate `electronuserland/builder:wine-mono`.

Google Chrome for testing is supported now only in the `electronuserland/electron-builder:wine-chrome` (498 MB). Mono is not supported in this image.
  • Loading branch information
develar committed Sep 22, 2017
1 parent c68abc3 commit d229335
Show file tree
Hide file tree
Showing 33 changed files with 114 additions and 113 deletions.
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- dependencies-{{ checksum "yarn.lock" }}
- restore_cache:
keys:
- v-1.8.0-electron
- v-1.7.6-electron2
- run:
command: yarn
- run:
Expand All @@ -23,14 +23,14 @@ jobs:
- run:
command: node ./test/out/helpers/downloadElectron.js
- save_cache:
key: v-1.8.0-electron
key: v-1.7.6-electron2
paths:
- ~/.cache/electron

test:
parallelism: 4
docker:
- image: electronuserland/electron-builder:wine
- image: electronuserland/builder:wine-mono
environment:
JEST_JUNIT_OUTPUT: ./test-reports/test.xml
steps:
Expand All @@ -46,7 +46,7 @@ jobs:
- dependencies-{{ checksum "yarn.lock" }}
- restore_cache:
keys:
- v-1.8.0-electron
- v-1.7.6-electron2
# because in the build job we use circleci docker image and circleci restores cache to original user home
- run:
command: |
Expand Down
1 change: 1 addition & 0 deletions .idea/dictionaries/develar.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# electron-builder [![npm version](https://img.shields.io/npm/v/electron-builder.svg?label=latest)](https://yarn.pm/electron-builder) [![downloads per month](http://img.shields.io/npm/dm/electron-builder.svg)](https://yarn.pm/electron-builder) [![donate](https://img.shields.io/badge/Donate-Donorbox-green.svg)](https://www.electron.build/donate)
# electron-builder [![npm version](https://img.shields.io/npm/v/electron-builder.svg?label=latest)](https://yarn.pm/electron-builder) [![downloads per month](https://img.shields.io/npm/dm/electron-builder.svg)](https://yarn.pm/electron-builder) [![donate](https://img.shields.io/badge/Donate-Donorbox-green.svg)](https://www.electron.build/donate)
A complete solution to package and build a ready for distribution Electron app for macOS, Windows and Linux with “auto update” support out of the box.

* NPM packages management:
* [Native application dependencies](http://electron.atom.io/docs/latest/tutorial/using-native-node-modules/) compilation (including [Yarn](http://yarnpkg.com/) support).
* [Native application dependencies](https://electron.atom.io/docs/tutorial/using-native-node-modules/) compilation (including [Yarn](http://yarnpkg.com/) support).
* Development dependencies are never included. You don't need to ignore them explicitly.
* [Code Signing](https://electron.build/code-signing) on a CI server or development machine.
* [Auto Update](https://electron.build/auto-update) ready application packaging.
Expand Down Expand Up @@ -70,8 +70,7 @@ Platform specific `7zip-bin-*` packages are `optionalDependencies`, which may re

To ensure your native dependencies are always matched electron version, simply add script `"postinstall": "electron-builder install-app-deps"` to your `package.json`.

5. If you have native addons of your own that are part of the application (not as a dependency), add `"nodeGypRebuild": true` to the `build` section of your development `package.json`.
:bulb: Don't [use](https://github.com/electron-userland/electron-builder/issues/683#issuecomment-241214075) [npm](http://electron.atom.io/docs/tutorial/using-native-node-modules/#using-npm) (neither `.npmrc`) for configuring electron headers. Use `electron-builder node-gyp-rebuild` instead.
5. If you have native addons of your own that are part of the application (not as a dependency), set [nodeGypRebuild](https://www.electron.build/configuration/configuration#Configuration-nodeGypRebuild) to `true`.

6. Install the [required system packages](https://electron.build/multi-platform-build) if you are not on macOS 10.12+.

Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ environment:
TEST_FILES: ExtraBuildTest,BuildTest,extraMetadataTest,filesTest,globTest,nsisUpdaterTest,oneClickInstallerTest,installerTest,appxTest

install:
- ps: Install-Product node 6 x64
- ps: Install-Product node 8 x64
- yarn

build: off
Expand Down
2 changes: 1 addition & 1 deletion book.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"root": "./docs",
"title": "electron-builder",
"plugins": ["edit-link", "github", "github-buttons", "develar-toolbar-buttons", "analytics", "advanced-emoji"],
"plugins": ["edit-link", "github", "github-buttons", "develar-toolbar-buttons", "analytics"],
"pluginsConfig": {
"edit-link": {
"base": "https://github.com/electron-userland/electron-builder/tree/master/docs"
Expand Down
9 changes: 6 additions & 3 deletions docker/6/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM electronuserland/electron-builder:base
FROM electronuserland/builder:base

# https://github.com/npm/npm/issues/4531
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - && apt-get install -y nodejs && npm config set unsafe-perm true && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - && apt-get install -y nodejs && \
# https://github.com/npm/npm/issues/4531
npm config set unsafe-perm true && \
# clean
apt-get clean && rm -rf /var/lib/apt/lists/*
2 changes: 1 addition & 1 deletion docker/8-ia32/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ RUN apt-get update \
&& add-apt-repository ppa:ubuntu-toolchain-r/test \
&& apt-get update \
&& apt-get install -y build-essential gnome-keyring libsecret-1-dev python-gnomekeyring clang \
&& curl -L https://yarnpkg.com/latest.tar.gz | tar xvz && mv dist /yarn \
&& curl -L https://yarnpkg.com/latest.tar.gz | tar xvz && mv yarn-* /yarn \
&& curl -sL https://deb.nodesource.com/setup_8.x | bash - && apt-get install -y nodejs && apt-get clean && rm -rf /var/lib/apt/lists/*

ENV PATH "/yarn/bin:$PATH"
Expand Down
9 changes: 6 additions & 3 deletions docker/8/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM electronuserland/electron-builder:base
FROM electronuserland/builder:base

# https://github.com/npm/npm/issues/4531
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - && apt-get install -y nodejs && npm config set unsafe-perm true && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - && apt-get install -y nodejs && \
# https://github.com/npm/npm/issues/4531
npm config set unsafe-perm true && \
# clean
apt-get clean && rm -rf /var/lib/apt/lists/*
48 changes: 19 additions & 29 deletions docker/base/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,36 +1,21 @@
FROM buildpack-deps:zesty-curl

# rpm is required for FPM to build rpm package
# yasm is required to build p7zip

# install modern multi-thread xz
# ldconfig - see 4.6. liblzma.so (or similar) not found when running xz

# python for node-gyp

# libsecret-1-0 for keytar

ENV XZ_VERSION 5.2.3

# we don't use our bundled 7za because it is better to build for specific platform - not generic
ENV USE_SYSTEM_7ZA true
ENV USE_SYSTEM_XORRISO true

ENV DEBUG_COLORS true
ENV FORCE_COLOR true
ENV DEBIAN_FRONTEND noninteractive

# locales for locale-gen
RUN curl -L https://yarnpkg.com/latest.tar.gz | tar xvz && mv yarn-* /yarn && \
apt-get update -y && apt-get install --no-install-recommends -y software-properties-common && \
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list && \
add-apt-repository ppa:snappy-dev/tools && apt-get update -y && apt-get upgrade -y && \
apt-get install --no-install-recommends -y google-chrome-stable libsecret-1-0 locales xvfb git snapcraft qtbase5-dev xorriso bsdtar build-essential autoconf libssl-dev icnsutils libopenjp2-7 graphicsmagick gcc-multilib g++-multilib libgnome-keyring-dev lzip rpm yasm python libcurl3 git ssh && \
RUN curl -L https://yarnpkg.com/latest.tar.gz | tar xvz && mv yarn-* /yarn && ln -s /yarn/bin/yarn /usr/bin/yarn && \
apt-get update -y && \
# locales for locale-gen, libsecret-1-0 for keytar
# git ssh for using as docker image on CircleCI
# python for node-gyp
# yasm is required to build p7zip
# rpm is required for FPM to build rpm package
apt-get install --no-install-recommends -y libsecret-1-0 locales git snapcraft qtbase5-dev xorriso bsdtar build-essential autoconf libssl-dev icnsutils libopenjp2-7 graphicsmagick gcc-multilib g++-multilib libgnome-keyring-dev lzip rpm yasm python libcurl3 git ssh && \
# libicns
curl -O http://mirrors.kernel.org/ubuntu/pool/universe/libi/libicns/libicns1_0.8.1-3.1_amd64.deb && dpkg --install libicns1_0.8.1-3.1_amd64.deb && unlink libicns1_0.8.1-3.1_amd64.deb && \
apt-get remove software-properties-common -y && \
apt-get clean && rm -rf /var/lib/apt/lists/* && \
curl -L http://tukaani.org/xz/xz-$XZ_VERSION.tar.xz | tar -xJ && cd xz-$XZ_VERSION && ./configure && make && make install && cd .. && rm -rf xz-$XZ_VERSION && ldconfig && \
mkdir -p /tmp/7z && curl -L http://downloads.sourceforge.net/project/p7zip/p7zip/16.02/p7zip_16.02_src_all.tar.bz2 | tar -xj -C /tmp/7z --strip-components 1 && cd /tmp/7z && cp makefile.linux_amd64_asm makefile.machine && make && make install && rm -rf /tmp/7z
# we don't use our bundled 7za because it is better to build for specific platform - not generic
mkdir -p /tmp/7z && curl -L http://downloads.sourceforge.net/project/p7zip/p7zip/16.02/p7zip_16.02_src_all.tar.bz2 | tar -xj -C /tmp/7z --strip-components 1 && cd /tmp/7z && cp makefile.linux_amd64_asm makefile.machine && make && make install && rm -rf /tmp/7z && rm -rf /usr/local/share/doc/p7zip && \
# clean
apt-get clean && rm -rf /var/lib/apt/lists/*

COPY test.sh /test.sh

Expand All @@ -43,4 +28,9 @@ RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
ENV PATH "/yarn/bin:$PATH"

ENV USE_SYSTEM_7ZA true
ENV USE_SYSTEM_XORRISO true

ENV DEBUG_COLORS true
ENV FORCE_COLOR true
10 changes: 6 additions & 4 deletions docker/build.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#!/usr/bin/env bash
set -e

docker build -t electronuserland/electron-builder:base docker/base
docker build -t electronuserland/builder:base docker/base

docker build -t electronuserland/electron-builder:8 -t electronuserland/electron-builder:latest docker/8
docker build -t electronuserland/electron-builder:6 docker/6
docker build -t electronuserland/builder:8 -t electronuserland/builder:latest docker/8
docker build -t electronuserland/builder:6 docker/6

docker build -t electronuserland/electron-builder:wine docker/wine
docker build -t electronuserland/builder:wine docker/wine
docker build -t electronuserland/builder:wine-mono docker/wine-mono
docker build -t electronuserland/builder:wine-chrome docker/wine-chrome
7 changes: 1 addition & 6 deletions docker/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@ It is developer documentation. See [user documentation](https://electron.build/d

# Build

```
docker build -t electronuserland/electron-builder docker
docker build -t electronuserland/electron-builder:wine docker/wine
```

Or just `npm run docker-images`
`yarn docker-images`

# Notes

Expand Down
7 changes: 7 additions & 0 deletions docker/wine-chrome/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM electronuserland/builder:wine

RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list && \
apt-get update -y && apt-get install -y --no-install-recommends xvfb google-chrome-stable && \
# clean
apt-get clean && rm -rf /var/lib/apt/lists/*
7 changes: 7 additions & 0 deletions docker/wine-mono/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM electronuserland/builder:wine

# since mono is required only for deprecated target Squirrel.Windows, extracted to separate docker image to reduce size

RUN apt-get update -y && \
apt-get install -y --no-install-recommends mono-devel ca-certificates-mono && \
apt-get clean && rm -rf /var/lib/apt/lists/*
11 changes: 0 additions & 11 deletions docker/wine-only/Dockerfile

This file was deleted.

8 changes: 5 additions & 3 deletions docker/wine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
FROM electronuserland/electron-builder:latest
FROM electronuserland/builder:latest

RUN dpkg --add-architecture i386 && apt-get update -y && apt-get install -y --no-install-recommends wine32 wine-stable mono-devel ca-certificates-mono && \
apt-get clean && rm -rf /var/lib/apt/lists/*
RUN dpkg --add-architecture i386 && apt-get update -y && \
apt-get install -y --no-install-recommends wine32 wine-stable && \
# clean
apt-get clean && rm -rf /var/lib/apt/lists/*

ENV WINEDEBUG -all,err+all
ENV WINEDLLOVERRIDES winemenubuilder.exe=d
Expand Down
9 changes: 4 additions & 5 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# electron-builder [![npm version](https://img.shields.io/npm/v/electron-builder.svg?label=latest)](https://yarn.pm/electron-builder) [![downloads per month](http://img.shields.io/npm/dm/electron-builder.svg)](https://yarn.pm/electron-builder)
# electron-builder [![npm version](https://img.shields.io/npm/v/electron-builder.svg?label=latest)](https://yarn.pm/electron-builder) [![downloads per month](https://img.shields.io/npm/dm/electron-builder.svg)](https://yarn.pm/electron-builder)
A complete solution to package and build a ready for distribution Electron app for macOS, Windows and Linux with “auto update” support out of the box.

* NPM packages management:
* [Native application dependencies](http://electron.atom.io/docs/latest/tutorial/using-native-node-modules/) compilation (including [Yarn](http://yarnpkg.com/) support).
* [Native application dependencies](https://electron.atom.io/docs/tutorial/using-native-node-modules/) compilation (including [Yarn](http://yarnpkg.com/) support).
* Development dependencies are never included. You don't need to ignore them explicitly.
* [Code Signing](code-signing.md) on a CI server or development machine.
* [Auto Update](auto-update.md) ready application packaging.
Expand Down Expand Up @@ -70,14 +70,13 @@ Platform specific `7zip-bin-*` packages are `optionalDependencies`, which may re

To ensure your native dependencies are always matched electron version, simply add script `"postinstall": "electron-builder install-app-deps"` to your `package.json`.

5. If you have native addons of your own that are part of the application (not as a dependency), add `"nodeGypRebuild": true` to the `build` section of your development `package.json`.
:bulb: Don't [use](https://github.com/electron-userland/electron-builder/issues/683#issuecomment-241214075) [npm](http://electron.atom.io/docs/tutorial/using-native-node-modules/#using-npm) (neither `.npmrc`) for configuring electron headers. Use `electron-builder node-gyp-rebuild` instead.
5. If you have native addons of your own that are part of the application (not as a dependency), set [nodeGypRebuild](/configuration#Configuration-nodeGypRebuild) to `true`.

6. Install the [required system packages](multi-platform-build.md) if you are not on macOS 10.12+.

Please note that everything is packaged into an asar archive [by default](configuration/configuration.md#Configuration-asar).

For an app that will be shipped to production, you should sign your application. See [Where to buy code signing certificates](code-signing.md#where-to-buy-code-signing-certificate).
For an app that will be shipped to production, you should sign your application. See [Where to buy code signing certificates](/code-signing.md#where-to-buy-code-signing-certificate).

## Programmatic Usage
See `node_modules/electron-builder/out/index.d.ts`. Typings for TypeScript is provided.
Expand Down
3 changes: 3 additions & 0 deletions docs/configuration/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,16 @@ Env file `electron-builder.env` in the current dir ([example](https://github.com

* <code id="Configuration-buildDependenciesFromSource">buildDependenciesFromSource</code> = `false` Boolean - Whether to build the application native dependencies from source.
* <code id="Configuration-nodeGypRebuild">nodeGypRebuild</code> = `false` Boolean - Whether to execute `node-gyp rebuild` before starting to package the app.

Don't [use](https://github.com/electron-userland/electron-builder/issues/683#issuecomment-241214075) [npm](http://electron.atom.io/docs/tutorial/using-native-node-modules/#using-npm) (neither `.npmrc`) for configuring electron headers. Use `electron-builder node-gyp-rebuild` instead.
* <code id="Configuration-npmArgs">npmArgs</code> Array&lt;String&gt; | String - Additional command line arguments to use when installing app native deps.
* <code id="Configuration-npmRebuild">npmRebuild</code> = `true` Boolean - Whether to [rebuild](https://docs.npmjs.com/cli/rebuild) native dependencies before starting to package the app.

---

* <code id="Configuration-buildVersion">buildVersion</code> String - The build version. Maps to the `CFBundleVersion` on macOS, and `FileVersion` metadata property on Windows. Defaults to the `version`. If `TRAVIS_BUILD_NUMBER` or `APPVEYOR_BUILD_NUMBER` or `CIRCLE_BUILD_NUM` or `BUILD_NUMBER` or `bamboo.buildNumber` env defined, it will be used as a build version (`version.build_number`).
* <code id="Configuration-detectUpdateChannel">detectUpdateChannel</code> = `true` Boolean - Whether to infer update channel from application version pre-release components. e.g. if version `0.12.1-alpha.1`, channel will be set to `alpha`. Otherwise to `latest`.
* <code id="Configuration-generateUpdatesFilesForAllChannels">generateUpdatesFilesForAllChannels</code> = `false` Boolean - Please see [Building and Releasing using Channels](https://github.com/electron-userland/electron-builder/issues/1182#issuecomment-324947139).
* <code id="Configuration-electronCompile">electronCompile</code> Boolean - Whether to use [electron-compile](http://github.com/electron/electron-compile) to compile app. Defaults to `true` if `electron-compile` in the dependencies. And `false` if in the `devDependencies` or doesn't specified.
* <code id="Configuration-electronDist">electronDist</code> String - The path to custom Electron build (e.g. `~/electron/out/R`).
* <code id="Configuration-electronDownload">electronDownload</code><a name="ElectronDownloadOptions"></a> - The [electron-download](https://github.com/electron-userland/electron-download#usage) options.
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration/dmg.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The top-level [dmg](configuration.md#Configuration-dmg) key contains set of opti
* <code id="DmgOptions-iconSize">iconSize</code> = `80` Number - The size of all the icons inside the DMG.
* <code id="DmgOptions-iconTextSize">iconTextSize</code> = `12` Number - The size of all the icon texts inside the DMG.
* <code id="DmgOptions-title">title</code> = `${productName} ${version}` String - The title of the produced DMG, which will be shown when mounted (volume name).

Macro `${productName}`, `${version}` and `${name}` are supported.
* <code id="DmgOptions-contents">contents</code> Array&lt;[DmgContent](#DmgContent)&gt; - The content — to customize icon locations.
* <code id="DmgOptions-format">format</code> = `UDZO` "UDRW" | "UDRO" | "UDCO" | "UDZO" | "UDBZ" | "ULFO" - The disk image format. `ULFO` (lzfse-compressed image (OS X 10.11+ only)).
Expand Down
Loading

0 comments on commit d229335

Please sign in to comment.