Skip to content

Commit

Permalink
Reduce Docker image size
Browse files Browse the repository at this point in the history
  • Loading branch information
szlend committed Jan 29, 2021
1 parent 14f2d0d commit d3f0e26
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
FROM node:10
FROM node:10-stretch-slim AS build

WORKDIR /app
RUN \
apt-get -y update && \
apt-get -y install dumb-init libopencv-dev && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN apt-get -y update \
&& apt-get -y install libopencv-dev \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

COPY package.json package.json
RUN mkdir tmp && npm install
RUN npm install && npm cache clean --force

COPY illuminati.js illuminati.js
FROM node:10-stretch-slim

RUN apt-get -y update \
&& apt-get -y install \
dumb-init \
libopencv-contrib2.4v5 \
libopencv-gpu2.4v5 \
libopencv-ocl2.4v5 \
libopencv-stitching2.4v5 \
libopencv-superres2.4v5 \
libopencv-ts2.4v5 \
libopencv-videostab2.4v5 \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

COPY --from=build /app/node_modules /app/node_modules
COPY illuminati.js /app/illuminati.js
RUN mkdir /app/tmp

WORKDIR /app
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["node", "illuminati.js"]
EXPOSE 3000

0 comments on commit d3f0e26

Please sign in to comment.