2
2
mirror of https://github.com/Llewellynvdm/nativefier.git synced 2024-12-22 10:08:55 +00:00

Run Nativefier with Docker (#311)

TODO: windows are currently not possible, because of non 64-bit version of `node-rcedit`, see https://github.com/electron/node-rcedit/issues/22. Also there is currently no 32-bit alpine package for wine, what possible solve this image.
This commit is contained in:
Tobias Schneck 2017-05-19 15:21:16 +02:00 committed by Jia Hao
parent f7881a246b
commit 95cc30983b
3 changed files with 99 additions and 0 deletions

49
.dockerignore Normal file
View File

@ -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

36
Dockerfile Normal file
View File

@ -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"]

View File

@ -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)