Skip to content

Commit 45788a5

Browse files
committed
Optimize result image
This patch makes some optimizations in the result service's image; - switch to `node:8.9-alpine`, which a smaller base image - use `https://` for the registry - use `COPY` instead of `ADD`, following best pracice - cleanup npm cache, and combine steps to reduce image size These changes bring down the image size from 248MB to 81.2MB Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 762543a commit 45788a5

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

result/Dockerfile

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
FROM node:8.9-slim
1+
FROM node:8.9-alpine
22

3+
RUN mkdir -p /app
34
WORKDIR /app
45

56
RUN npm install -g nodemon
6-
ADD package.json /app/package.json
7-
RUN npm config set registry http://registry.npmjs.org
8-
RUN npm install && npm ls
9-
RUN mv /app/node_modules /node_modules
10-
11-
ADD . /app
7+
RUN npm config set registry https://registry.npmjs.org
8+
COPY package.json /app/package.json
9+
RUN npm install \
10+
&& npm ls \
11+
&& npm cache clean --force \
12+
&& mv /app/node_modules /node_modules
13+
COPY . /app
1214

1315
ENV PORT 80
1416
EXPOSE 80

0 commit comments

Comments
 (0)