-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
64 lines (44 loc) · 1.75 KB
/
Dockerfile
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
FROM node:17.9.0-alpine as build
WORKDIR /app
RUN apk add --no-cache sudo build-base g++ libpng libpng-dev jpeg-dev pango-dev cairo-dev giflib-dev python3
RUN apk --no-cache add ca-certificates wget && \
wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub && \
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.35-r1/glibc-2.35-r1.apk && \
apk add glibc-2.35-r1.apk && \
rm glibc-2.35-r1.apk
COPY package.json .
RUN npm install && \
npm cache clean --force && \
npm install tsc -g
COPY tsconfig.json .
COPY src ./src
ENV NODE_ENV production
RUN npm run build
FROM node:17.9.0-alpine as test
WORKDIR /app
COPY package.json .
COPY --from=build /app/node_modules /app/node_modules
COPY tsconfig.json .
COPY src ./src
COPY test ./test
CMD ["npm", "run", "test"]
FROM node:17.9.0-alpine
WORKDIR /app
RUN apk add --no-cache tzdata curl libpng jpeg pango cairo giflib
ENV TZ Europe/Warsaw
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apk add --update --repository http://dl-3.alpinelinux.org/alpine/edge/testing \
libmount ttf-dejavu ttf-opensans fontconfig
COPY package.json .
COPY --from=build /app/node_modules /app/node_modules
COPY --from=build /app/build /app/build
RUN npm prune --production
COPY polish-stocks.json ./
RUN echo "30 19 * * 1-5 cd /app; node build/gpw-tweets.js > /proc/1/fd/1 2> /proc/1/fd/2" >> /etc/crontabs/root && \
echo "30 19 * * 6 cd /app; node build/gpw-tweets.js --weekly > /proc/1/fd/1 2> /proc/1/fd/2" >> /etc/crontabs/root
VOLUME /app/mstall
VOLUME /app/images
COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["crond", "-f", "-d", "8"]