47 lines
1.1 KiB
Docker
47 lines
1.1 KiB
Docker
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.sr.ht/~heckyel/yt-local"
|
|
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 --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"]
|