aboutsummaryrefslogtreecommitdiffstats
path: root/core/Dockerfile
blob: 384400b07e00952ab760703a6812e240da5123b4 (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
47
48
49
FROM index.docker.io/python:3.11.8-alpine3.19 AS base
LABEL MAINTAINER="heckyel@riseup.net"

# Image to Build Dependencies
FROM base AS builder

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

RUN apk update && apk upgrade && apk add --no-cache musl-dev build-base make gcc g++ libffi-dev git patch

ARG APP_DIR="/srv/app"
ARG YT_REPO="https://git.sr.ht/~heckyel/yt-local"
ARG YT_BRANCH="0.2.14"

RUN mkdir --parents "$APP_DIR"

WORKDIR "$APP_DIR"

RUN git clone --depth=1 "$YT_REPO" --branch "$YT_BRANCH" "$APP_DIR" && \
git show --oneline --no-patch
RUN pip install --upgrade pip && \
pip install --no-cache-dir --prefix=/install wheel gunicorn
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt

COPY 0001.patch "$APP_DIR/0001.patch"
RUN patch -Np1 -i "$APP_DIR/0001.patch"

# clean
RUN rm -f "$APP_DIR/0001.patch" && apk del git patch

# Runtime Environment Image
FROM base

WORKDIR /srv/app

# Runtime Dependencies
RUN apk update && apk upgrade && apk --no-cache add tor curl
COPY --from=builder /install /usr/local
COPY --from=builder /srv/app /srv/app

EXPOSE 8080

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

ENTRYPOINT ["/entrypoint.sh"]