diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..5206a3c --- /dev/null +++ b/.dockerignore @@ -0,0 +1,49 @@ +# OSX +.DS_Store + +# Node.js + +# ignore compiled lib files +lib/* +app/lib/* +built-tests + +# commit a placeholder to keep the app/lib directory +!app/lib/.placeholder + +dist + +# Logs +logs +*.log +npm-debug.log* + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directory +# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git +node_modules + +# IntelliJ project files +.idea +*.iml +out +gen diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c65e04a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,36 @@ +FROM node:7-alpine +LABEL description="Alpine image to build nativfier apps" + +### Install wine depedency +RUN apk add --no-cache \ + wine \ + freetype \ + imagemagick \ + ### make symbolic link to use `wine` + && ln -s /usr/bin/wine64 /usr/bin/wine + +# Add sources +COPY . /nativefier + +### Build app package for nativefier installation +RUN cd /nativefier/app && npm install \ + # Build and install nativefier binary + && cd /nativefier && npm install && npm run build && npm install -g \ + ## Remove no longer needed sources + && rm -rf /nativefier + + +### Use 1000 as default user not root +USER 1000 + +### Check that installation was sucessfull and chache all electron installation. +### Ensures that no addtional download will needed at runtime exectuion `docker run`. +RUN nativefier https://github.com/jiahaog/nativefier /tmp/nativefier \ + && nativefier -p osx https://github.com/jiahaog/nativefier /tmp/nativefier \ +# TODO: windows are currently not possible, because of non 64-bit `node-rcedit`, see https://github.com/electron/node-rcedit/issues/22. +# && nativefier -p windows https://github.com/jiahaog/nativefier /tmp/nativefier \ + #remove not need test aplication + && rm -rf /tmp/nativefier + +ENTRYPOINT ["nativefier"] +CMD ["--help"] diff --git a/README.md b/README.md index 24870cc..b7c8de6 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,20 @@ See [Changelog](docs/changelog.md). See [Development](docs/development.md). +## Docker Image + +The [Dockerfile](Dockerfile) is designed that you can use it like the "normal" nativefier app. By default the command `nativefier --version` will be executed. Before you can use the Image you have to build it like follow: + + docker build -t local/nativefier . + +After that you can build your first nativefier app to the local `$TARGET-PATH`. Please ensure that you have write access to the `$TARGET-PATH`: + + docker run -v $TARGET-PATH:/target local/nativefier https://my-web-app.com/ /target/ + +You can also use additional source or nativefier options like e.g. use a icon: + + docker run -v $PATH_TO_ICON/:/src -v $TARGET-PATH:/target local/nativefier --icon /src/icon.png --name whatsApp -p linux -a x64 https://my-web-app.com/ /target/ + ## License [MIT](LICENSE.md)