aboutsummaryrefslogtreecommitdiffstats
path: root/core/Dockerfile
blob: 5d6e04f3c64179e88ac0ecd4d4753451f1d1cdc9 (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.18"

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"]