From aa5d4a18502dd393eee6d6ed3716c90e44e03179 Mon Sep 17 00:00:00 2001 From: Speng Reb Date: Mon, 4 May 2026 16:26:32 +0200 Subject: [PATCH] Add docker compose setup --- .gitignore | 2 ++ Dockerfile | 18 ++++++++++++++++++ config.template.yaml | 4 ++-- docker-compose.yml | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.gitignore b/.gitignore index 204865bf..edcc4a2d 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,5 @@ www/js/cytube-google-drive.meta.js www/js/player.js tor-exit-list.json *.patch +mysql/ +peertube-hosts.json \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..befee5a6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM node:20 + +RUN apt update && apt install -y build-essential git wget + +COPY ./ /app +WORKDIR /app + +RUN rm -rf node_modules lib package-lock.json +RUN npm cache clean --force +RUN npm install +RUN /bin/sh /app/postinstall.sh +RUN npm run build-server +RUN npm rebuild + +RUN wget https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -O /usr/local/bin/yt-dlp +RUN chmod a+rx /usr/local/bin/yt-dlp + +CMD ["node", "index.js"] \ No newline at end of file diff --git a/config.template.yaml b/config.template.yaml index b24de8d8..fddbec1a 100644 --- a/config.template.yaml +++ b/config.template.yaml @@ -4,11 +4,11 @@ # user: username to authenticate as # password: password for user mysql: - server: 'localhost' + server: 'mysql' port: 3306 database: 'cytube3' user: 'cytube3' - password: '' + password: 'strong-password-here' pool-size: 10 # Define IPs/ports to listen on diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..ac7732e2 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,35 @@ +version: "3.7" +services: + sync: + build: . + depends_on: + mysql: + condition: service_healthy + ports: + - "8080:8080" + - "1337:1337" + - "8443:8443" + volumes: + - "./templates/head.pug:/app/templates/head.pug" + - "./favicon.ico:/app/www/favicon.ico" + - "./config.yaml:/app/config.yaml" + mysql: + image: docker.io/library/mariadb:latest + healthcheck: + test: ["CMD", "mariadb-admin","ping","-h","localhost", "-u", "root", "--password=sync"] + interval: 5s + timeout: 3s + retries: 100 + environment: + - MARIADB_AUTO_UPGRADE=1 + - MARIADB_ROOT_PASSWORD=sync + - MARIADB_DATABASE=cytube3 + - MARIADB_USER=cytube3 + - MARIADB_PASSWORD=strong-password-here + volumes: +# This will create and mount the mysql files in the same folder as the docker-compose.yml file. +# You can change this to be anywhere. +# This will provide data persistence to your MariaDB database. + - "./mysql:/var/lib/mysql" +# If you are using a reverse proxy please do not forget to add the network here as well. +# Refer to the Readme for more information regarding using a Reverse Proxy.