Skip to content
This repository was archived by the owner on Apr 7, 2020. It is now read-only.

Commit 0ba7666

Browse files
authored
Merge pull request #78 from weblyzard/master
Set Electron version via --build-args
2 parents f0caca3 + db7661a commit 0ba7666

File tree

1 file changed

+36
-20
lines changed

1 file changed

+36
-20
lines changed

Dockerfile

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,52 @@ FROM buildpack-deps:jessie-curl
22

33
LABEL maintainer="Mihkel Sokk <mihkelsokk@gmail.com>"
44

5-
ENV RENDERER_ACCESS_KEY=changeme CONCURRENCY=1 WINDOW_WIDTH=1024 WINDOW_HEIGHT=768 NODE_ENV=production \
6-
ELECTRON_VERSION=4.0.6 ELECTRON_ENABLE_STACK_DUMPING=true ELECTRON_ENABLE_LOGGING=true ELECTRON_DISABLE_SECURITY_WARNINGS=true
5+
ENV RENDERER_ACCESS_KEY=changeme \
6+
CONCURRENCY=1 \
7+
WINDOW_WIDTH=1024 \
8+
WINDOW_HEIGHT=768 \
9+
NODE_ENV=production \
10+
ELECTRON_ENABLE_STACK_DUMPING=true \
11+
ELECTRON_ENABLE_LOGGING=true \
12+
ELECTRON_DISABLE_SECURITY_WARNINGS=true
713

814
WORKDIR /app
915

1016
# Add subpixel hinting
1117
COPY .fonts.conf /root/.fonts.conf
1218

1319
# Install the packages needed to run Electron
14-
RUN sed -i 's/main/main contrib/g' /etc/apt/sources.list && \
15-
curl -sL https://deb.nodesource.com/setup_10.x | bash - && \
16-
apt-get upgrade -y && \
17-
apt-get install -y unzip xvfb libgtk2.0-0 ttf-mscorefonts-installer libnotify4 libgconf2-4 libxss1 libnss3 dbus-x11 && \
18-
\
19-
# Get Electron
20-
wget "https://github.com/electron/electron/releases/download/v${ELECTRON_VERSION}/electron-v${ELECTRON_VERSION}-linux-x64.zip" -O electron.zip && \
21-
unzip electron.zip && rm electron.zip && \
22-
\
23-
# Cleanup
24-
apt-get remove -y unzip && apt-get clean && rm -rf /var/lib/apt/lists/*
25-
26-
# as the inline fonts should not change much put them before the app
20+
RUN sed -i 's/main/main contrib/g' /etc/apt/sources.list
21+
RUN apt-get -y update
22+
RUN apt-get -y upgrade
23+
RUN apt-get install -y unzip xvfb libgtk2.0-0 ttf-mscorefonts-installer libnotify4 libgconf2-4 libxss1 libnss3 dbus-x11
24+
25+
# As the inline fonts should not change much put them before the app
2726
COPY fonts/* /usr/share/fonts/truetype/
2827

29-
COPY package.json /app/package.json
28+
# Install NodeJS
29+
RUN curl -sSL http://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
30+
RUN echo "deb http://deb.nodesource.com/node_10.x jessie main" > /etc/apt/sources.list.d/nodesource.list
31+
RUN apt-get -y update
32+
RUN apt-get -y install nodejs
3033

31-
RUN apt-get update && apt-get install -y nodejs && \
32-
sed -i '/\"electron\"\:/d' ./package.json && \
33-
npm install --production --no-optional && \
34-
apt-get remove -y nodejs && apt-get clean && rm -rf /var/lib/apt/lists/*
34+
# Install dependencies
35+
COPY package.json /app/package.json
36+
RUN sed -i '/\"electron\"\:/d' ./package.json
37+
RUN npm install --production --no-optional
38+
39+
# Install Electron
40+
# You can define a different Electron version on build using the `--build-args electron_version=x.y.z` argument
41+
ARG electron_version=4.0.6
42+
RUN wget "https://github.com/atom/electron/releases/download/v${electron_version}/electron-v${electron_version}-linux-x64.zip" -O electron.zip
43+
RUN unzip electron.zip
44+
RUN rm electron.zip
45+
46+
# Clean up
47+
RUN apt-get remove -y unzip nodejs
48+
RUN apt-get clean
49+
RUN rm -rf /var/lib/apt/lists/*
50+
RUN rm -f /etc/apt/sources.list.d/nodesource.list
3551

3652
COPY . /app
3753

0 commit comments

Comments
 (0)