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