-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
31 lines (25 loc) · 915 Bytes
/
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
FROM node:18-alpine AS base
WORKDIR /usr/src/opentitles
COPY package*.json ./
# Get the latest definition file from GitHub
FROM alpine/git:latest AS definition
WORKDIR /usr/src/opentitles
RUN git clone https://github.com/opentitles/definition.git defs
# Builder image used only for compiling Typescript files
FROM base AS builder
RUN npm ci
COPY . .
RUN npm run compile
# Lean production image that just contains the dist directory, media definitions and runtime dependencies
FROM base AS prod
RUN npm ci --only=production
COPY --from=builder /usr/src/opentitles/dist .
COPY --from=definition /usr/src/opentitles/defs/media.json .
# Setup cronjob to run crawler
RUN mkdir -p /etc/cron.d
COPY opentitles-cron /etc/cron.d/opentitles-cron
RUN chmod 0644 /etc/cron.d/opentitles-cron
RUN crontab /etc/cron.d/opentitles-cron
RUN touch /var/log/cron.log
RUN touch /usr/src/opentitles/crawler.log
CMD ["crond", "-f"]