forked from UrielCh/opencv4nodejs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.debian.examples
40 lines (38 loc) · 1.55 KB
/
Dockerfile.debian.examples
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# docker build --build-arg VERSION=1.0.0 -t test-debian -f Dockerfile.debian.examples .
# docker run --rm test-debian
# docker run -it --rm test-debian bash
##############
# First step transpile Typescript to JS files with NODE_ENV=development
FROM urielch/opencv-nodejs:6.2.5-debian As build
WORKDIR /usr/src/app
ENV NODE_ENV=development
RUN npm install -g [email protected]
COPY examples/package.json ./
COPY examples/tsconfig.prod.json ./tsconfig.json
RUN sed -i -r "s/\"@u4\/opencv4nodejs\": \".+\",//g" package.json
RUN npm install && npm cache clean --force
RUN npm link @u4/opencv4nodejs
COPY examples/src/applyColorMap.ts examples/src/utils.ts ./src/
# do not need data at transpile step
# COPY ./data/Lenna.png /usr/src/data/Lenna.png
RUN npx tsc
##############
# Second step Build finAal image and clean node_nodules content this time NODE_ENV=production
FROM urielch/opencv-nodejs:6.2.5-debian
WORKDIR /usr/src/app
ENV NODE_ENV=production
COPY --from=build /usr/src/app/package*.json ./
RUN npm install -g [email protected] && \
npm install && \
rimraf node_modules/**/*.{md,ts,map,h,c,cc,cpp,gyp,yml,txt} node_modules/**/{LICENSE,.github,.npmignore,LICENSE.txt,.travis.yml,.eslintrc,sponsors} && \
npm uninstall -g [email protected] && \
npm cache clean --force && \
find . -type f -empty -print -delete && \
find . -type d -empty -print -delete && \
npm link @u4/opencv4nodejs
COPY ./data/Lenna.png /usr/src/data/Lenna.png
COPY --from=build /usr/src/app/src/*.js ./src/
# ARG VERSION
# ENV VERSION=$VERSION
ENV HEADLESS=1
CMD ["node", "src/applyColorMap"]