From ff84ece681c3413d213dfc2f714d2316fd3001e1 Mon Sep 17 00:00:00 2001 From: Dryusdan Date: Sat, 16 Nov 2019 10:49:03 +0100 Subject: [PATCH] update config --- Dockerfile | 56 ++++--------- rootfs/PeerTube/config/production.yaml | 82 ------------------- rootfs/etc/nginx/sites-enabled/peertube.conf | 47 ----------- rootfs/usr/local/bin/startup-alpine | 38 --------- rootfs/usr/local/bin/startup-debian | 38 --------- .../docker/production/docker-entrypoint.sh | 64 +++++++++++++++ 6 files changed, 81 insertions(+), 244 deletions(-) delete mode 100644 rootfs/PeerTube/config/production.yaml delete mode 100644 rootfs/etc/nginx/sites-enabled/peertube.conf delete mode 100755 rootfs/usr/local/bin/startup-alpine delete mode 100755 rootfs/usr/local/bin/startup-debian create mode 100644 support/docker/production/docker-entrypoint.sh diff --git a/Dockerfile b/Dockerfile index 0a40046..0a5a79b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,29 +1,14 @@ FROM debian:bullseye-slim ARG PEERTUBE_VER=v2.0.0 +ARG NPM_RUN_BUILD_OPTS + +ENV UID=991 \ + GID=991 \ + FORCE_CHOWN=false \ + NODE_ENV=production \ + NODE_CONFIG_DIR=/config -ENV UID=991 GID=991 \ - HTTPS=false \ - HOSTNAME=peertube.localhost \ - PORT=80 \ - DATABASE_HOST=localhost \ - DATABASE_PORT=5432 \ - DATABASE_USERNAME=peertube \ - DATABASE_PASSWORD=peertube \ - ADMIN_EMAIL=admin@domain.local \ - SIGNUP_ENABLE=false \ - TRANSCODING_ENABLE=false \ - TRANSCODING_THREADS=2 \ - BODY_SIZE=100M \ - CACHE_SIZE=100 \ - SIGNUP_LIMIT=10 \ - VIDEO_QUOTA=-1 \ - RESOLUTION_280=true \ - RESOLUTION_360=true \ - RESOLUTION_480=true \ - RESOLUTION_720=true \ - RESOLUTION_1080=true \ - DEBIAN_FRONTEND=noninteractive RUN groupadd -g 991 peertube && useradd -u 991 -g 991 --create-home peertube \ && echo "deb http://ftp.debian.org/debian bullseye-backports main contrib non-free" >> /etc/apt/sources.list \ @@ -31,42 +16,35 @@ RUN groupadd -g 991 peertube && useradd -u 991 -g 991 --create-home peertube \ && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \ && apt-get update \ - && apt-get -y --no-install-recommends install nodejs yarn curl gosu gnupg dirmngr ffmpeg openssl git build-essential nginx-light \ + && apt-get -y --no-install-recommends install nodejs yarn curl gnupg dirmngr ffmpeg openssl git build-essential \ && apt-get clean \ && echo "****** Clone Peertube ******" \ - && git clone --branch ${PEERTUBE_VER} https://github.com/Chocobozzz/PeerTube /PeerTube \ + && git clone --branch ${PEERTUBE_VER} https://github.com/Chocobozzz/PeerTube /app \ && echo "****** chown ******" \ - && chown -R peertube:peertube PeerTube \ - && cd /PeerTube \ + && chown -R peertube:peertube /app \ + && cd /app \ && echo "****** run npm install as user ******" \ - && su - peertube -c "cd /PeerTube && npm install" \ + && su - peertube -c "cd /app && npm run build -- $NPM_RUN_BUILD_OPTS && rm -r ./node_modules ./client/node_modules " \ && echo "****** run yarn install as user ******" \ - && su - peertube -c "cd /PeerTube && yarn install" \ - && echo "****** run npm run build as user ******" \ - && su - peertube -c "cd /PeerTube && npm run build" \ + && su - peertube -c "cd /app && yarn install --pure-lockfile --production && yarn cache clean" \ && apt-get remove --purge --yes build-essential curl git \ && apt-get autoremove -y \ && apt-get clean \ - && rm -rf /PeerTube/.git \ + && rm -rf /app/.git \ && rm -rf /tmp/* /var/lib/apt/lists/* /var/cache/debconf/*-old \ && rm -rf /usr/share/man/?? \ && rm -rf /usr/share/man/??_* \ && mkdir -p /{data,config} \ && chown -R peertube:peertube /data /config -WORKDIR /PeerTube/ - -ENV NODE_ENV production -ENV NODE_CONFIG_DIR /config +WORKDIR /app/ VOLUME ["/data", "/config"] -VOLUME /config EXPOSE 9000 -COPY rootfs / +COPY ./support/docker/production/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh -RUN chmod +x /usr/local/bin/startup +ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] -ENTRYPOINT ["/usr/local/bin/startup"] CMD ["npm", "start"] diff --git a/rootfs/PeerTube/config/production.yaml b/rootfs/PeerTube/config/production.yaml deleted file mode 100644 index 790b410..0000000 --- a/rootfs/PeerTube/config/production.yaml +++ /dev/null @@ -1,82 +0,0 @@ -listen: - port: 9000 - -# Correspond to your reverse proxy "listen" configuration -webserver: - https: - hostname: '' - port: - -# Your database name will be "peertube"+database.suffix -database: - hostname: '' - port: - suffix: '_prod' - username: '' - password: '' - -redis: - hostname: 'redis_hostname' - port: 'redis_port' - auth: null - -smtp: - hostname: '' - port: - username: '' - password: '' - tls: - ca_file: null # Used for self signed certificates - from_address: '' - -# From the project root directory -storage: - avatars: 'avatars/' - certs: 'certs/' - videos: 'videos/' - logs: 'logs/' - previews: 'previews/' - thumbnails: 'thumbnails/' - torrents: 'torrents/' - - -log: - level: 'info' # debug/info/warning/error - -cache: - previews: - size: - -admin: - email: '' - -signup: - enabled: - limit: # When the limit is reached, registrations are disabled. -1 == unlimited - -user: - # Default value of maximum video BYTES the user can upload (does not take into account transcoded files). - # -1 == unlimited - video_quota: - -# If enabled, the video will be transcoded to mp4 (x264) with "faststart" flag -# Uses a lot of CPU! -transcoding: - enabled: - threads: - resolutions: # Only created if the original video has a higher resolution - 240p: - 360p: - 480p: - 720p: - 1080p: - - -instance: - name: '' - description: '' # Support markdown - terms: '' # Support markdown - default_client_route: '/videos/trending' - customizations: - javascript: '' # Directly your JavaScript code (without