-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Dockerfile
50 lines (34 loc) · 1 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
FROM node:20.10 AS BUILD_IMAGE
# install node-prune
RUN curl -sf https://gobinaries.com/tj/node-prune | sh
WORKDIR /work
COPY . /work/
# install
RUN npm install
# build
RUN npm run build
# remove development dependencies
RUN npm prune --production
# run node prune
RUN /usr/local/bin/node-prune
FROM node:20.10-alpine
# add ffmpeg
RUN apk add --no-cache ffmpeg
ENV TOKEN=$TOKEN
# ENV CRON_SCHEDULE="*/1 * * * *"
ENV CRON_SCHEDULE="*/15 * * * *"
ENV CRON_SCHEDULE_TIMELAPSE="0 7 * * *"
WORKDIR /app
# copy from build image
COPY --from=BUILD_IMAGE /work/dist ./dist
COPY --from=BUILD_IMAGE /work/node_modules ./node_modules
COPY --from=BUILD_IMAGE /work/package.json .
# Setup the cron job to
RUN echo "$CRON_SCHEDULE cd /app && npm run snapshot" >> /etc/crontabs/root
RUN echo "$CRON_SCHEDULE_TIMELAPSE cd /app && npm run timelapse" >> /etc/crontabs/root
# Create the cron log
RUN touch /var/log/cron.log
# Setup our start file
COPY ./cron/run.sh /tmp/run.sh
RUN chmod +x /tmp/run.sh
CMD ["/tmp/run.sh"]