From 303f96a139d971813e75d9f34b008264517ddc03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Le=20Calvar?= Date: Thu, 27 Apr 2023 09:16:34 +0200 Subject: [PATCH] Update readme with up to date Dockerfile and docker-compose.yml --- README.md | 170 +++++++----------------------------------------------- 1 file changed, 22 insertions(+), 148 deletions(-) diff --git a/README.md b/README.md index b40dbf0..d9b78e4 100644 --- a/README.md +++ b/README.md @@ -13,60 +13,21 @@ For more information on vaapi and hardware acceleration: # Building a compatible docker image Official docker images do not ship with required libraries for hardware transcode. -You can build your own image with this docker compose: +You can build your own image with the following Dockerfile: -```yaml -FROM node:12-buster-slim +```Dockerfile +ARG VERSION=v4.2.0 +FROM chocobozzz/peertube:${VERSION}-bullseye -# Allow to pass extra options to the npm run build -# eg: --light --light-fr to not build all client languages -# (speed up build time if i18n is not required) -ARG NPM_RUN_BUILD_OPTS -# Install dependencies -RUN apt update \ - && apt install -y --no-install-recommends openssl ffmpeg python ca-certificates gnupg gosu build-essential wget apt-transport-https git \ - && echo "deb http://deb.debian.org/debian/ $( awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release ) non-free" | tee /etc/apt/sources.list.d/non-free.list \ - && apt update \ - && apt install -y --no-install-recommends vainfo i965-va-driver-shaders \ - && gosu nobody true \ - && rm /var/lib/apt/lists/* -fR - -# Add peertube user -RUN groupadd -r peertube \ - && useradd -r -g peertube -m peertube - -# Install PeerTube -COPY --chown=peertube:peertube . /app -WORKDIR /app - -USER peertube - -RUN yarn install --pure-lockfile \ - && npm run build -- $NPM_RUN_BUILD_OPTS \ - && rm -r ./node_modules ./client/node_modules \ - && yarn install --pure-lockfile --production \ - && yarn cache clean - -USER root - -RUN mkdir /data /config -RUN chown -R peertube:peertube /data /config - -ENV NODE_ENV production -ENV NODE_CONFIG_DIR /config - -VOLUME /data -VOLUME /config - -COPY ./support/docker/production/entrypoint.sh /usr/local/bin/entrypoint.sh -ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] - -# Expose API and RTMP -EXPOSE 9000 1935 - -# Run the application -CMD ["npm", "start"] +# install dependencies for vaapi +RUN apt update \ + && apt install -y --no-install-recommends wget apt-transport-https \ + && echo "deb http://deb.debian.org/debian/ $( awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release ) non-free" | tee /etc/apt/sources.list.d/non-free.list \ + && apt update \ + && apt install -y --no-install-recommends vainfo i965-va-driver-shaders \ + && apt install -y --no-install-recommends python3 \ + && rm /var/lib/apt/lists/* -fR ``` If you are using a recent Intel CPU (generation 8 and newer), replace `i965-va-driver-shaders` by `intel-media-va-driver-non-free`. @@ -78,111 +39,24 @@ In order to access the GPU inside docker, the `docker-compose.yml` should be ada Note that you must find the id of the `render` group on your machine. You can use `grep render /etc/group | cut -d':' -f3` to find the id. + ```yaml version: "2" services: - - # You can comment this webserver section if you want to use another webserver/proxy - webserver: - image: chocobozzz/peertube-webserver:latest - # If you don't want to use the official image and build one from sources: - # build: - # context: . - # dockerfile: Dockerfile.nginx - env_file: - - .env - ports: - - "80:80" - - "443:443" - volumes: - - type: bind - # Switch sources if you downloaded the whole repository - #source: ../../nginx/peertube - source: ./docker-volume/nginx/peertube - target: /etc/nginx/conf.d/peertube.template - - assets:/var/www/peertube/peertube-latest/client/dist:ro - - ./docker-volume/data:/var/www/peertube/storage - - certbot-www:/var/www/certbot - - ./docker-volume/certbot/conf:/etc/letsencrypt - depends_on: - - peertube - restart: "always" - - # You can comment this certbot section if you want to use another webserver/proxy - certbot: - container_name: certbot - image: certbot/certbot - volumes: - - ./docker-volume/certbot/conf:/etc/letsencrypt - - certbot-www:/var/www/certbot - restart: unless-stopped - entrypoint: /bin/sh -c "trap exit TERM; while :; do certbot renew --webroot -w /var/www/certbot; sleep 12h & wait $${!}; done;" - depends_on: - - webserver - peertube: - # If you don't want to use the official image and build one from sources: - # build: - # context: . - # dockerfile: ./support/docker/production/Dockerfile.buster - image: chocobozzz/peertube:production-buster - # Use a static IP for this container because nginx does not handle proxy host change without reload - # This container could be restarted on crash or until the postgresql database is ready for connection - networks: - default: - ipv4_address: 172.18.0.42 - env_file: - - .env + # replace image key with + build: + context: . + args: + VERSION: v5.0.1 + # usual peertube configuration + # ... - ports: - - "1935:1935" # If you don't want to use the live feature, you can comment this line - # - "9000:9000" # If you provide your own webserver and reverse-proxy, otherwise not suitable for production - volumes: - - assets:/app/client/dist - - ./docker-volume/data:/data - - ./docker-volume/config:/config + # add these keys group_add: - devices: # VAAPI Devices - /dev/dri:/dev/dri - depends_on: - - postgres - - redis - - postfix - restart: "always" - - postgres: - image: postgres:13-alpine - env_file: - - .env - volumes: - - ./docker-volume/db:/var/lib/postgresql/data - restart: "always" - - redis: - image: redis:6-alpine - volumes: - - ./docker-volume/redis:/data - restart: "always" - - postfix: - image: mwader/postfix-relay - env_file: - - .env - volumes: - - ./docker-volume/opendkim/keys:/etc/opendkim/keys - restart: "always" - -networks: - default: - ipam: - driver: default - config: - - subnet: 172.18.0.0/16 - -volumes: - assets: - certbot-www: -``` \ No newline at end of file +```