aboutsummaryrefslogtreecommitdiffstats
path: root/core/Dockerfile
blob: 79ffae4f7568eb9380ac298089c29f8f120ed941 (plain)
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
FROM docker.io/python:3.11-alpine AS base

FROM base AS builder

ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8

ARG APP_DIR="/srv/app"
ARG YT_REPO="https://git.fridu.us/heckyel/yt-local.git"
ARG YT_BRANCH="v0.2.19"

RUN apk update && \
apk upgrade && \
apk add --no-cache musl-dev build-base make gcc g++ libffi-dev git patch && \
mkdir -p "$APP_DIR" && \
git clone --depth=1 "$YT_REPO" --branch "$YT_BRANCH" "$APP_DIR" && \
git -C "$APP_DIR" show --oneline --no-patch && \
pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir --prefix=/install wheel gunicorn && \
pip install --no-cache-dir --prefix=/install -r "$APP_DIR/requirements.txt"

COPY 0001.patch "$APP_DIR/0001.patch"

RUN patch -Np1 -i "$APP_DIR/0001.patch" -d "$APP_DIR" && \
rm -f "$APP_DIR/0001.patch" && \
apk del git patch

FROM base

ARG APP_DIR="/srv/app"
WORKDIR "$APP_DIR"

RUN apk update && \
apk upgrade && \
apk add --no-cache tor curl

COPY --from=builder /install /usr/local
COPY --from=builder "$APP_DIR" "$APP_DIR"

EXPOSE 8080

COPY entrypoint-tor.sh /
COPY entrypoint.sh /
RUN chmod u+x /entrypoint-tor.sh /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]