2021-09-05 17:10:14 +00:00
|
|
|
# build the tube archivist image from default python slim image
|
|
|
|
|
2022-03-29 11:34:31 +00:00
|
|
|
FROM python:3.10.4-slim-bullseye
|
2021-10-12 16:00:25 +00:00
|
|
|
ARG TARGETPLATFORM
|
2022-03-24 12:54:47 +00:00
|
|
|
ARG INSTALL_DEBUG
|
2021-09-05 17:10:14 +00:00
|
|
|
|
|
|
|
ENV PYTHONUNBUFFERED 1
|
|
|
|
|
|
|
|
# install distro packages needed
|
|
|
|
RUN apt-get clean && apt-get -y update && apt-get -y install --no-install-recommends \
|
|
|
|
build-essential \
|
|
|
|
nginx \
|
2022-02-12 02:58:14 +00:00
|
|
|
atomicparsley \
|
2021-09-05 17:10:14 +00:00
|
|
|
curl && rm -rf /var/lib/apt/lists/*
|
|
|
|
|
2021-10-12 16:00:25 +00:00
|
|
|
# get newest patched ffmpeg and ffprobe builds for amd64 fall back to repo ffmpeg for arm64
|
|
|
|
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ] ; then \
|
|
|
|
curl -s https://api.github.com/repos/yt-dlp/FFmpeg-Builds/releases/latest \
|
|
|
|
| grep browser_download_url \
|
2022-02-21 14:37:49 +00:00
|
|
|
| grep ".*master.*linux64.*tar.xz" \
|
2021-10-12 16:00:25 +00:00
|
|
|
| cut -d '"' -f 4 \
|
|
|
|
| xargs curl -L --output ffmpeg.tar.xz && \
|
|
|
|
tar -xf ffmpeg.tar.xz --strip-components=2 --no-anchored -C /usr/bin/ "ffmpeg" && \
|
|
|
|
tar -xf ffmpeg.tar.xz --strip-components=2 --no-anchored -C /usr/bin/ "ffprobe" && \
|
|
|
|
rm ffmpeg.tar.xz \
|
|
|
|
; elif [ "$TARGETPLATFORM" = "linux/arm64" ] ; then \
|
|
|
|
apt-get -y update && apt-get -y install --no-install-recommends ffmpeg && rm -rf /var/lib/apt/lists/* \
|
|
|
|
; fi
|
2021-09-30 15:01:30 +00:00
|
|
|
|
2022-03-24 12:54:47 +00:00
|
|
|
# install debug tools for testing environment
|
|
|
|
RUN if [ "$INSTALL_DEBUG" ] ; then \
|
|
|
|
apt-get -y update && apt-get -y install --no-install-recommends \
|
|
|
|
vim htop bmon net-tools iputils-ping procps \
|
|
|
|
&& pip install --no-cache-dir ipython --src /usr/local/src \
|
|
|
|
; fi
|
|
|
|
|
2021-09-05 17:10:14 +00:00
|
|
|
# make folders
|
|
|
|
RUN mkdir /cache
|
|
|
|
RUN mkdir /youtube
|
|
|
|
RUN mkdir /app
|
|
|
|
|
|
|
|
# install python dependencies
|
|
|
|
COPY ./tubearchivist/requirements.txt /requirements.txt
|
2022-04-10 09:45:50 +00:00
|
|
|
RUN pip install --upgrade pip && \
|
|
|
|
pip install --upgrade setuptools && \
|
|
|
|
pip install --no-cache-dir -r requirements.txt --src /usr/local/src
|
2021-09-05 17:10:14 +00:00
|
|
|
|
2022-01-01 15:16:34 +00:00
|
|
|
# copy config files
|
2022-04-01 04:43:24 +00:00
|
|
|
COPY docker_assets/nginx.conf /etc/nginx/sites-available/default
|
2022-01-01 15:16:34 +00:00
|
|
|
|
2021-09-05 17:10:14 +00:00
|
|
|
# copy application into container
|
|
|
|
COPY ./tubearchivist /app
|
2022-01-26 13:05:52 +00:00
|
|
|
COPY ./docker_assets/run.sh /app
|
|
|
|
COPY ./docker_assets/uwsgi.ini /app
|
2021-09-05 17:10:14 +00:00
|
|
|
|
|
|
|
# volumes
|
|
|
|
VOLUME /cache
|
|
|
|
VOLUME /youtube
|
|
|
|
|
|
|
|
# start
|
|
|
|
WORKDIR /app
|
2021-09-16 08:36:14 +00:00
|
|
|
EXPOSE 8000
|
2021-09-05 17:10:14 +00:00
|
|
|
|
|
|
|
RUN chmod +x ./run.sh
|
|
|
|
|
|
|
|
CMD ["./run.sh"]
|