-
-
Notifications
You must be signed in to change notification settings - Fork 105
/
Dockerfile
48 lines (39 loc) · 1.51 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
FROM node:20.2.0-alpine3.16 as installer
COPY package.json yarn.lock /freyr/
WORKDIR /freyr
ARG YOUTUBE_DL_SKIP_PYTHON_CHECK=1
RUN yarn install --prod --frozen-lockfile \
&& test -x node_modules/youtube-dl-exec/bin/yt-dlp
FROM golang:1.20.4-alpine3.16 as prep
# hadolint ignore=DL3018
RUN apk add --no-cache git g++ make cmake linux-headers
COPY --from=installer /freyr/node_modules /freyr/node_modules
RUN go install github.com/tj/node-prune@1159d4c \
&& node-prune --include '*.map' /freyr/node_modules \
&& node-prune /freyr/node_modules \
# todo! revert to upstream when https://github.com/wez/atomicparsley/pull/63 is merged and a release is cut
&& git clone --branch 20230114.175602.21bde60 --depth 1 https://github.com/miraclx/atomicparsley /atomicparsley \
&& cmake -S /atomicparsley -B /atomicparsley \
&& cmake --build /atomicparsley --config Release
FROM alpine:3.20.1 as base
# hadolint ignore=DL3018
RUN apk add --no-cache bash nodejs python3 \
&& find /usr/lib/python3* \
\( -type d -name __pycache__ -o -type f -name '*.whl' \) \
-exec rm -r {} \+
COPY --from=prep /atomicparsley/AtomicParsley /bin/AtomicParsley
COPY . /freyr
COPY --from=prep /freyr/node_modules /freyr/node_modules
# hadolint ignore=DL4006
RUN addgroup -g 1000 freyr \
&& adduser -DG freyr freyr \
&& echo freyr:freyr | chpasswd \
&& ln -s /freyr/cli.js /bin/freyr \
&& mkdir /data \
&& chown -R freyr:freyr /freyr /data
WORKDIR /freyr
USER freyr
WORKDIR /data
VOLUME /data
ENTRYPOINT ["/freyr/freyr.sh"]
CMD ["--help"]