tubearchivist/Dockerfile

88 lines
2.2 KiB
Docker
Raw Normal View History

# multi stage to build tube archivist
# build python wheel, download and extract ffmpeg, copy into final image
2021-09-06 00:10:14 +07:00
2025-01-27 17:47:11 +07:00
FROM node:lts-alpine AS node-builder
DRAFT: Add Tubearchivist Frontend React dev docker setup (#768) * Add development docker-compose file * Add /new/ path in nginx conf * Add frontend production setup * Fix lint * Refac move prod docker compose into non suffixed file * Fix run.sh fileendings on windows * Fix docker file naming consistancies * Add frontend dev setup * Add docker compose dev command * Refac remove docker network * Fix potential error causes * Chore update react-router-dom * Add redirect to login after logout * Refac allow basic auth for session login in api * Fix loginresponsetype optional property * Refac move isAdmin check into page Base * Refac use node lts for dev container * Refac remove old setup in readme * Refac move getisAdmin into loader and rename * Refac remove manual csrf cookie handing from actions and loader * Fix post requiring csrf header & cookie * Fix remove empty files * Refac revert dockerfile changes * Refac revert gitatrributes changes * Refac revert docker changes * Refac revert nginx changes * Refac revert docker change * Refac move frontend into frontend folder * Add production steps to dockerfile * Refac implement endpoint renaming * Refac remove frontend dockerfile * Add credentials include for dev env * Fix allow cors with credentials for dev environment * Fix images in dev mode * Add credentials for dev mode to all loader and actions, except signin * Revert cors config * Revert cors config * Fix nginx not serving /youtube/ * Fix video url missing api * Fix media url missing api * Add application settings page * Add continue vids * Add csrf to delete requests * Refac use api/video endpoint with filter to home, channel, playlist pages * Add channel nav request * Add channel playlists * Fix filterbar for playlist in channel * Add playlist_nav to video page * Add downloads aggs * Refac remove basic auth * Fix credentials include in signin * Refac user config to user me config * Add ApiToken get
2024-08-10 19:53:50 +02:00
# RUN npm config set registry https://registry.npmjs.org/
COPY ./frontend /frontend
WORKDIR /frontend
RUN npm i
RUN npm run build:deploy
WORKDIR /
# First stage to build python wheel
2024-05-15 19:54:16 +02:00
FROM python:3.11.8-slim-bookworm AS builder
2021-09-06 00:10:14 +07:00
2022-10-25 11:22:32 +07:00
RUN apt-get update && apt-get install -y --no-install-recommends \
2023-10-03 20:49:57 +07:00
build-essential gcc libldap2-dev libsasl2-dev libssl-dev git
# install requirements
2024-08-03 21:58:22 +02:00
COPY ./backend/requirements.txt /requirements.txt
RUN pip install --user -r requirements.txt
# build ffmpeg
2025-01-27 17:47:11 +07:00
FROM python:3.11.8-slim-bookworm AS ffmpeg-builder
ARG TARGETPLATFORM
COPY docker_assets/ffmpeg_download.py ffmpeg_download.py
RUN python ffmpeg_download.py $TARGETPLATFORM
# build final image
2025-01-27 17:47:11 +07:00
FROM python:3.11.8-slim-bookworm AS tubearchivist
ARG INSTALL_DEBUG
2025-02-18 22:39:40 +07:00
ENV PYTHONUNBUFFERED=1
# copy build requirements
COPY --from=builder /root/.local /root/.local
ENV PATH=/root/.local/bin:$PATH
# copy ffmpeg
COPY --from=ffmpeg-builder ./ffmpeg/ffmpeg /usr/bin/ffmpeg
COPY --from=ffmpeg-builder ./ffprobe/ffprobe /usr/bin/ffprobe
# install distro packages needed
RUN apt-get clean && apt-get -y update && apt-get -y install --no-install-recommends \
nginx \
atomicparsley \
curl && rm -rf /var/lib/apt/lists/*
# install debug tools for testing environment
RUN if [ "$INSTALL_DEBUG" ] ; then \
apt-get -y update && apt-get -y install --no-install-recommends \
2025-02-02 15:36:25 +07:00
vim htop bmon net-tools iputils-ping procps lsof \
2024-05-21 12:18:25 +02:00
&& pip install --user ipython pytest pytest-django \
; fi
2021-09-06 00:10:14 +07:00
# make folders
RUN mkdir /cache /youtube /app
2021-09-06 00:10:14 +07:00
# copy config files
COPY docker_assets/nginx.conf /etc/nginx/sites-available/default
RUN sed -i 's/^user www\-data\;$/user root\;/' /etc/nginx/nginx.conf
2021-09-06 00:10:14 +07:00
# copy application into container
2024-08-03 21:58:22 +02:00
COPY ./backend /app
2022-01-26 20:05:52 +07:00
COPY ./docker_assets/run.sh /app
2024-12-23 21:53:27 +07:00
COPY ./docker_assets/backend_start.py /app
2025-06-03 23:03:13 +07:00
COPY ./docker_assets/beat_auto_spawn.sh /app
2021-09-06 00:10:14 +07:00
DRAFT: Add Tubearchivist Frontend React dev docker setup (#768) * Add development docker-compose file * Add /new/ path in nginx conf * Add frontend production setup * Fix lint * Refac move prod docker compose into non suffixed file * Fix run.sh fileendings on windows * Fix docker file naming consistancies * Add frontend dev setup * Add docker compose dev command * Refac remove docker network * Fix potential error causes * Chore update react-router-dom * Add redirect to login after logout * Refac allow basic auth for session login in api * Fix loginresponsetype optional property * Refac move isAdmin check into page Base * Refac use node lts for dev container * Refac remove old setup in readme * Refac move getisAdmin into loader and rename * Refac remove manual csrf cookie handing from actions and loader * Fix post requiring csrf header & cookie * Fix remove empty files * Refac revert dockerfile changes * Refac revert gitatrributes changes * Refac revert docker changes * Refac revert nginx changes * Refac revert docker change * Refac move frontend into frontend folder * Add production steps to dockerfile * Refac implement endpoint renaming * Refac remove frontend dockerfile * Add credentials include for dev env * Fix allow cors with credentials for dev environment * Fix images in dev mode * Add credentials for dev mode to all loader and actions, except signin * Revert cors config * Revert cors config * Fix nginx not serving /youtube/ * Fix video url missing api * Fix media url missing api * Add application settings page * Add continue vids * Add csrf to delete requests * Refac use api/video endpoint with filter to home, channel, playlist pages * Add channel nav request * Add channel playlists * Fix filterbar for playlist in channel * Add playlist_nav to video page * Add downloads aggs * Refac remove basic auth * Fix credentials include in signin * Refac user config to user me config * Add ApiToken get
2024-08-10 19:53:50 +02:00
COPY --from=node-builder ./frontend/dist /app/static
2021-09-06 00:10:14 +07:00
# volumes
VOLUME /cache
VOLUME /youtube
# start
WORKDIR /app
2021-09-16 15:36:14 +07:00
EXPOSE 8000
2021-09-06 00:10:14 +07:00
RUN chmod +x ./run.sh
CMD ["./run.sh"]