Migrating videos from YouTube to PeerTube inside a Docker container

I have quite a few videos hosted on YouTube that I would like to upload to my new PeerTube location, but I don’t want to install all the PeerTube dependencies on my machine, so I did it all inside a Docker image.

First I built and started a Docker container:

$ git clone https://github.com/chocobozzz/PeerTube /tmp/peertube
$ cd /tmp/peertube
$ docker build . -f ./support/docker/production/Dockerfile.buster --tag peertube
$ docker run --tty --interactive peertube bash

Then I ran these commands inside it:

# apt update && apt install git -y && apt upgrade -y
# npm install -g npm n typescript
# n stable
# yarn upgrade yarn
# NODE_ENV=develop NOCLIENT=1 yarn install --pure-lockfile --production=false
# NODE_ENV=develop npm run setup:cli
# node dist/server/tools/peertube-import-videos.js --url "https://peertube.mastodon.host" --username "andybalaam" --target-url "https://www.youtube.com/watch?v=TG0qRDrUPpA" --password=mypw

Of course, it would be better to write this up into its own Dockerfile to make this a one-liner.

References: PeerTube Docker setup, PeerTube video import.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.