-FROM janitortechnology/ubuntu-dev
+FROM ubuntu:bionic
+
+# Avoid tzdata interactive dialog
+ENV DEBIAN_FRONTEND=noninteractive
# Install PeerTube's dependencies.
# Packages are from https://github.com/Chocobozzz/PeerTube#dependencies
-RUN sudo apt-get update -q && sudo apt-get install -qy \
+RUN apt-get update -q && apt-get install -qy \
+ curl \
+ nano \
ffmpeg \
postgresql \
- openssl
+ postgresql-contrib \
+ openssl \
+ g++ \
+ make \
+ redis-server \
+ git \
+ gnupg
+
+# Install NodeJS 8.x
+RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - && \
+ apt-get install -y nodejs
+
+# Install Yarn
+RUN 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 install yarn
# Download PeerTube's source code.
RUN git clone -b develop https://github.com/Chocobozzz/PeerTube /home/user/PeerTube
WORKDIR /home/user/PeerTube
-# Configure the IDEs to use Janitor's source directory as workspace.
-ENV WORKSPACE /home/user/PeerTube/
-
# Install dependencies.
RUN yarn install --pure-lockfile
-# Configure Janitor for PeerTube.
-COPY --chown=user:user janitor.json /home/user/
+# Configure and run PeerTube.
+COPY setup_postgres.sql /tmp/
+RUN service postgresql start \
+ && su postgres -c "psql --file=/tmp/setup_postgres.sql"
-# Configure and build PeerTube.
-COPY create_user.sql /tmp/
-RUN sudo service postgresql start \
- && sudo -u postgres psql --file=/tmp/create_user.sql \
- && npm run build
-
-COPY --chown=user:user supervisord.conf /tmp/supervisord-extra.conf
-RUN cat /tmp/supervisord-extra.conf | sudo tee -a /etc/supervisord.conf
+# Expose PeerTube sources as a volume
+VOLUME /home/user/PeerTube
EXPOSE 3000 9000
+
+# Start PostgreSQL and Redis
+CMD service postgresql start && redis-server
--- /dev/null
+### Usage
+1. Build the image:
+ ```
+ docker build -t my_peertube_dev .
+ ```
+1. Start the container:
+ ```
+ docker run -d -i -p 3000:3000 -p 9000:9000 --name peertube my_peertube_dev
+ ```
+ This will create a new Docker volume containing PeerTube sources.
+
+1. Start PeerTube inside the container:
+ ```
+ docker exec -it peertube npm run dev
+ ```
+1. In another window, find the path to the Docker volume
+ ```
+ docker inspect peertube | less +/Mounts
+ ```
+ You can now make changes to the files. They should be automatically recompiled.
--- /dev/null
+FROM janitortechnology/ubuntu-dev
+
+# Install PeerTube's dependencies.
+# Packages are from https://github.com/Chocobozzz/PeerTube#dependencies
+RUN sudo apt-get update -q && sudo apt-get install -qy \
+ ffmpeg \
+ postgresql \
+ openssl
+
+# Download PeerTube's source code.
+RUN git clone -b develop https://github.com/Chocobozzz/PeerTube /home/user/PeerTube
+WORKDIR /home/user/PeerTube
+
+# Configure the IDEs to use Janitor's source directory as workspace.
+ENV WORKSPACE /home/user/PeerTube/
+
+# Install dependencies.
+RUN yarn install --pure-lockfile
+
+# Configure Janitor for PeerTube.
+COPY --chown=user:user janitor.json /home/user/
+
+# Configure and build PeerTube.
+COPY create_user.sql /tmp/
+RUN sudo service postgresql start \
+ && sudo -u postgres psql --file=/tmp/create_user.sql \
+ && npm run build
+
+COPY --chown=user:user supervisord.conf /tmp/supervisord-extra.conf
+RUN cat /tmp/supervisord-extra.conf | sudo tee -a /etc/supervisord.conf
+
+EXPOSE 3000 9000