Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize Dockerfile #97

Merged
merged 1 commit into from
Oct 17, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 24 additions & 28 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,38 +1,34 @@
FROM debian:jessie-slim
FROM node:8-alpine

ENV EPHIMERAL_PACKAGES "build-essential dh-autoreconf curl xz-utils python binutils"
ENV PACKAGES "libpng-dev"

# Add `package.json` to build Debian compatible NPM packages
WORKDIR /src
ADD package.json .

# install everything (and clean up afterwards)
RUN apt-get update \
&& apt-get install -y apt-utils \
&& apt-get install -y ${EPHIMERAL_PACKAGES} ${PACKAGES} \
&& curl -sL https://deb.nodesource.com/setup_8.x | bash - \
&& apt-get install -y nodejs \
&& cd /src \
&& npm i \
; apt-get remove --purge -y ${EPHIMERAL_PACKAGES} \
; apt-get autoremove -y ${EPHIMERAL_PACKAGES} \
; apt-get clean \
; apt-get autoclean \
; echo -n > /var/lib/apt/extended_states \
; rm -rf /var/lib/apt/lists/* \
; rm -rf /usr/share/man/?? \
; rm -rf /usr/share/man/??_*

# Add the remaining project files
ADD . .

# Build distribution
RUN npm run build
# The official image has verbose logging; change it to npm's default
ENV NPM_CONFIG_LOGLEVEL notice

# Set the default host/port
ENV HOST 0.0.0.0
ENV PORT 4000

# Start the server by default
CMD npm run server

ADD package.json package-lock.json ./

# Install everything (and clean up afterwards)
RUN apk add --no-cache --virtual .gyp \
autoconf \
automake \
g++ \
libpng-dev \
libtool \
make \
nasm \
python \
&& npm install \
&& apk del .gyp

# Add the remaining project files
ADD . .

# Build distribution
RUN npm run build