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

Commit

Permalink
Use Debian Jessie directly as base image
Browse files Browse the repository at this point in the history
  • Loading branch information
msokk committed Feb 16, 2016
1 parent 1d3b695 commit 733db43
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 14 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@
dev.js
npm-debug.log

bin/
test/
src/
node_modules/
30 changes: 21 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,34 @@
FROM node:slim
FROM buildpack-deps:jessie-curl

MAINTAINER Mihkel Sokk <[email protected]>

ENV RENDERER_ACCESS_KEY=changeme CONCURRENCY=1 WINDOW_WIDTH=1024 WINDOW_HEIGHT=768 NODE_ENV=production
ENV RENDERER_ACCESS_KEY=changeme CONCURRENCY=1 WINDOW_WIDTH=1024 WINDOW_HEIGHT=768 NODE_ENV=production \
ELECTRON_VERSION=0.36.7 ELECTRON_ENABLE_STACK_DUMPING=true ELECTRON_ENABLE_LOGGING=true

# Add subpixel hinting
COPY .fonts.conf /root/.fonts.conf

COPY . /app
WORKDIR /app

# Install the packages needed to run Electron
RUN npm install --production && \
sed -i 's/main/main contrib/g' /etc/apt/sources.list && \
apt-get update && apt-get upgrade -y && apt-get install -y xvfb \
libgtk2.0-0 ttf-mscorefonts-installer libnotify4 libgconf2-4 libnss3 dbus-x11 && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# Install the packages needed to run Electron
RUN sed -i 's/main/main contrib/g' /etc/apt/sources.list && \
curl -sL https://deb.nodesource.com/setup_5.x | bash - && \

apt-get update && apt-get upgrade -y && \
apt-get install -y nodejs unzip xvfb libgtk2.0-0 ttf-mscorefonts-installer libnotify4 libgconf2-4 libnss3 dbus-x11 && \

# Get Electron
wget "https://github.com/atom/electron/releases/download/v${ELECTRON_VERSION}/electron-v${ELECTRON_VERSION}-linux-x64.zip" -O electron.zip && \
unzip electron.zip && rm electron.zip && \

# Install dependencies without electron-prebuilt
sed -i '/electron-prebuilt/d' ./package.json && \
npm install --production && \

# Cleanup
apt-get remove -y unzip nodejs && apt-get clean && rm -rf /var/lib/apt/lists/*

EXPOSE 3000

CMD xvfb-run --server-args="-screen 0 ${WINDOW_WIDTH}x${WINDOW_HEIGHT}x24" npm start
CMD xvfb-run --server-args="-screen 0 ${WINDOW_WIDTH}x${WINDOW_HEIGHT}x24" ./electron --disable-gpu lib/server.js
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Simple PDF/PNG/JPEG render service, accepts webpage URL and returns the resource

## Docker usage

Based on official [Node.js Jessie](https://hub.docker.com/_/node/) image, uses latest [electron](https://github.com/atom/electron).
Based on official [Debian Jessie](https://hub.docker.com/_/debian/) image, uses latest [electron](https://github.com/atom/electron).


1. `docker run -t -e RENDERER_ACCESS_KEY=secret -p 3000:3000 msokk/electron-render-service`
Expand Down
2 changes: 1 addition & 1 deletion bin/electron-render-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ const electron = require('electron-prebuilt');
const proc = require('child_process');

const args = path.join(__dirname, '../lib/server.js');
const child = proc.spawn(electron, [args], { stdio: 'inherit' });
const child = proc.spawn(electron, ['--disable-gpu', args], { stdio: 'inherit' });

child.on('close', code => process.exit(code));
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
{
"name": "electron-render-service",
"version": "0.4.0",
"version": "0.4.1",
"description": "Microservice for rendering PDF/PNG/JPEG from HTML with Electron",
"bin": {
"electron-render-service": "./bin/electron-render-service.js"
},
"scripts": {
"start": "electron lib/server.js",
"dev": "electron dev.js",
"start": "electron dev.js",
"build": "babel src -d lib",
"lint": "eslint src",
"test": "mocha --compilers js:babel-register"
Expand Down

0 comments on commit 733db43

Please sign in to comment.