Fix #461 & address #375 in Docker: move Dockerfile to Debian and use wine32 (#488)

- Should address #375 (building a win app from linux) under Docker,
  thanks @dipenpatel235 for the suggestion to use `wine32` at
  https://github.com/jiahaog/nativefier/issues/375#issuecomment-304247033
- Regarding #461, Docker build seems fine but it was already
  fine for some time, not sure what happened.

Also clean up a bit the Dockerfile using suggestions from
[hadolint](https://github.com/lukasmartinelli/hadolint/).
This commit is contained in:
Ronan Jouchet 2017-11-24 10:28:59 -05:00 committed by GitHub
parent db74db8911
commit 2b377a7916
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 22 deletions

View File

@ -1,35 +1,33 @@
FROM node:8-alpine
LABEL description="Alpine image to build nativfier apps"
FROM node:8-stretch
LABEL description="Debian image to build nativefier apps"
### Dependencies
RUN apk add --no-cache \
wine \
freetype \
imagemagick \
### make symbolic link to use `wine`
&& ln -s /usr/bin/wine64 /usr/bin/wine
# Get wine32, not 64, to work around binary incompatibility with rcedit.
# https://github.com/jiahaog/nativefier/issues/375#issuecomment-304247033
# Forced us to use Debian rather than Alpine, which doesn't do multiarch.
RUN dpkg --add-architecture i386
# Install dependencies
RUN apt-get update \
&& apt-get --yes install wine32 imagemagick \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# 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 \
# Expose globally
&& npm link
# Build nativefier and link globally
WORKDIR /nativefier/app
RUN npm install
WORKDIR /nativefier
RUN npm install && npm run build && npm link
### Use 1000 as default user not root
# Use 1000 as default user not root
USER 1000
### Check that installation was sucessful and cache electron installations.
### Ensures that no addtional download will be needed at `docker run` runtime.
# Run a {lin,mac,win} build: 1. to check installation was sucessful,
# 2. to cache electron distributables and avoid downloads at runtime.
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
&& nativefier -p windows https://github.com/jiahaog/nativefier /tmp/nativefier \
&& rm -rf /tmp/nativefier
ENTRYPOINT ["nativefier"]