2021-03-02 05:16:30 +00:00
|
|
|
FROM node:12-alpine
|
|
|
|
LABEL description="Alpine image to build Nativefier apps"
|
2017-05-19 13:21:16 +00:00
|
|
|
|
2017-11-24 15:28:59 +00:00
|
|
|
|
|
|
|
# Install dependencies
|
2021-03-02 05:16:30 +00:00
|
|
|
RUN apk update \
|
|
|
|
&& apk add bash wine imagemagick dos2unix \
|
|
|
|
&& rm -rf /var/cache/apk/*
|
|
|
|
|
|
|
|
WORKDIR /nativefier
|
2017-11-16 19:07:24 +00:00
|
|
|
|
2017-05-19 13:21:16 +00:00
|
|
|
# Add sources
|
2021-03-02 05:16:30 +00:00
|
|
|
COPY . .
|
|
|
|
|
|
|
|
# Fix line endings that may have gotten mangled in Windows
|
|
|
|
RUN find ./icon-scripts ./src ./app -type f -print0 | xargs -0 dos2unix
|
2017-05-19 13:21:16 +00:00
|
|
|
|
2017-11-24 15:28:59 +00:00
|
|
|
# Build nativefier and link globally
|
|
|
|
WORKDIR /nativefier/app
|
|
|
|
RUN npm install
|
|
|
|
WORKDIR /nativefier
|
2021-03-02 05:16:30 +00:00
|
|
|
|
|
|
|
# Install (note that we had to manually install in `app` before, as `prepare` won't run as root)
|
|
|
|
# Also, running tests, to ensure we don't Docker build & publish broken stuff
|
|
|
|
RUN npm install && npm run build && npm test && npm link
|
|
|
|
|
|
|
|
# Cleanup test artifacts
|
|
|
|
RUN rm -rf /tmp/nativefier*
|
2017-05-19 13:21:16 +00:00
|
|
|
|
2017-11-24 15:28:59 +00:00
|
|
|
# Use 1000 as default user not root
|
2017-05-19 13:21:16 +00:00
|
|
|
USER 1000
|
|
|
|
|
2021-03-02 05:16:30 +00:00
|
|
|
# Run a {lin,mac,win} build
|
|
|
|
# 1. to check installation was sucessful
|
|
|
|
# 2. to cache electron distributables and avoid downloads at runtime
|
2021-01-30 04:49:52 +00:00
|
|
|
RUN nativefier https://github.com/nativefier/nativefier /tmp/nativefier \
|
|
|
|
&& nativefier -p osx https://github.com/nativefier/nativefier /tmp/nativefier \
|
2021-03-02 05:16:30 +00:00
|
|
|
&& nativefier -p windows https://github.com/nativefier/nativefier /tmp/nativefier
|
|
|
|
|
|
|
|
|
|
|
|
RUN echo Generated Electron cache size: $(du -sh ~/.cache/electron) \
|
|
|
|
&& rm -rf /tmp/nativefier \
|
|
|
|
&& echo Final image size: $(du -sh / 2>/dev/null)
|
2017-05-19 13:21:16 +00:00
|
|
|
|
|
|
|
ENTRYPOINT ["nativefier"]
|
|
|
|
CMD ["--help"]
|