Skip to content

Commit 18acc29

Browse files
authored
Merge pull request #97 from kane-c/optimize-docker
Optimize Dockerfile
2 parents d8afc60 + 777c01c commit 18acc29

File tree

1 file changed

+24
-28
lines changed

1 file changed

+24
-28
lines changed

Dockerfile

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,34 @@
1-
FROM debian:jessie-slim
1+
FROM node:8-alpine
22

3-
ENV EPHIMERAL_PACKAGES "build-essential dh-autoreconf curl xz-utils python binutils"
4-
ENV PACKAGES "libpng-dev"
5-
6-
# Add `package.json` to build Debian compatible NPM packages
73
WORKDIR /src
8-
ADD package.json .
9-
10-
# install everything (and clean up afterwards)
11-
RUN apt-get update \
12-
&& apt-get install -y apt-utils \
13-
&& apt-get install -y ${EPHIMERAL_PACKAGES} ${PACKAGES} \
14-
&& curl -sL https://deb.nodesource.com/setup_8.x | bash - \
15-
&& apt-get install -y nodejs \
16-
&& cd /src \
17-
&& npm i \
18-
; apt-get remove --purge -y ${EPHIMERAL_PACKAGES} \
19-
; apt-get autoremove -y ${EPHIMERAL_PACKAGES} \
20-
; apt-get clean \
21-
; apt-get autoclean \
22-
; echo -n > /var/lib/apt/extended_states \
23-
; rm -rf /var/lib/apt/lists/* \
24-
; rm -rf /usr/share/man/?? \
25-
; rm -rf /usr/share/man/??_*
264

27-
# Add the remaining project files
28-
ADD . .
29-
30-
# Build distribution
31-
RUN npm run build
5+
# The official image has verbose logging; change it to npm's default
6+
ENV NPM_CONFIG_LOGLEVEL notice
327

338
# Set the default host/port
349
ENV HOST 0.0.0.0
3510
ENV PORT 4000
3611

3712
# Start the server by default
3813
CMD npm run server
14+
15+
ADD package.json package-lock.json ./
16+
17+
# Install everything (and clean up afterwards)
18+
RUN apk add --no-cache --virtual .gyp \
19+
autoconf \
20+
automake \
21+
g++ \
22+
libpng-dev \
23+
libtool \
24+
make \
25+
nasm \
26+
python \
27+
&& npm install \
28+
&& apk del .gyp
29+
30+
# Add the remaining project files
31+
ADD . .
32+
33+
# Build distribution
34+
RUN npm run build

0 commit comments

Comments
 (0)