forked from iv-org/invidious-companion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
47 lines (30 loc) · 1.07 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
FROM denoland/deno:debian-2.1.4 AS builder
ARG TINI_VERSION=0.19.0
WORKDIR /app
# cache dir for youtube.js library
RUN mkdir -p /var/tmp/youtubei.js
RUN apt update && apt install -y curl
COPY ./src/ /app/src/
COPY deno.json /app/
RUN curl -fsSL https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini-$(dpkg --print-architecture) \
--output /tini \
&& chmod +x /tini
RUN deno task compile
# Stage for creating the non-privileged user
FROM alpine:3.20 AS user-stage
RUN adduser -u 10001 -S appuser
FROM gcr.io/distroless/cc
COPY --from=builder /app/invidious_companion /app/
COPY ./config/ /app/config/
COPY --from=builder /tini /tini
ENV PORT=8282 \
HOST=0.0.0.0
# Copy passwd file for the non-privileged user from the user-stage
COPY --from=user-stage /etc/passwd /etc/passwd
# Copy cache directory and set correct permissions
COPY --from=builder --chown=appuser /var/tmp/youtubei.js /var/tmp/youtubei.js
# Set the working directory
WORKDIR /app
# Switch to non-privileged user
USER appuser
ENTRYPOINT ["/tini", "--", "/app/invidious_companion"]