Browse Source

Refactor Dockerfile to use current best practices (#2276)

* reduces final image size from 1.6GB -> 1.4GB
* reduces image build time (from 24 min 07 sec to 19 min 31 sec on my laptop)
* implements Docker's best practices and makes better usage of the layer cache

Best practices defined as per official docs from Docker.
https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/
tags/v4.2.0
Jayce Gregg 2 years ago
parent
commit
773b99d7a5
2 changed files with 29 additions and 17 deletions
  1. 29
    17
      Dockerfile
  2. 0
    0
      vendor/docker-entrypoint.sh

+ 29
- 17
Dockerfile View File

@@ -1,25 +1,37 @@
FROM node:6.3

RUN apt-get update
RUN apt-get install g++-multilib lib32z1 lib32ncurses5 -y
RUN apt-get install rpm fakeroot dpkg libdbus-1-dev libx11-dev -y
RUN apt-get install libavahi-compat-libdnssd-dev g++ -y
RUN apt-get install gcc-4.8-multilib g++-4.8-multilib -y
RUN apt-get install libgtk2.0-0 libgtk2.0-dev xvfb -y
RUN apt-get install libxtst6 -y
ENV ELECTRON_ENABLE_STACK_DUMPING true
ENV ELECTRON_ENABLE_LOGGING true

WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
dpkg \
fakeroot \
g++ \
g++-4.8-multilib \
g++-multilib \
gcc-4.8-multilib \
lib32ncurses5 \
lib32z1 \
libasound2 \
libavahi-compat-libdnssd-dev \
libdbus-1-dev \
libgconf-2-4 \
libgtk2.0-0 \
libgtk2.0-dev \
libnss3 \
libx11-dev \
libxss1 \
libxtst6 \
rpm \
xvfb \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /app
COPY package.json /app
RUN npm install

RUN apt-get install libxss1 libnss3 libasound2 libgconf-2-4 -y

RUN export ELECTRON_ENABLE_STACK_DUMPING=true
RUN export ELECTRON_ENABLE_LOGGING=true
RUN npm install \
&& npm cache clean \
&& rm -rf /tmp/npm*

ADD vendor/docker-entrypoint.sh /entrypoint.sh
RUN chmod 777 /entrypoint.sh
ENTRYPOINT ["/bin/sh", "/entrypoint.sh"]
ENTRYPOINT ["vendor/docker-entrypoint.sh"]

COPY . /app

+ 0
- 0
vendor/docker-entrypoint.sh View File


Loading…
Cancel
Save