diff options
author | am97 <andy.maldo@hotmail.com> | 2018-10-09 17:35:02 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-10-09 17:35:02 +0200 |
commit | ee7c25c767c357bd12570889f8ccd79ba9ea4eb9 (patch) | |
tree | 06478edd377bf8cfcf5e69a26fb696b37491ffc8 /support/docker | |
parent | e2dc00a8feb8fe0ebfe92eb88aa13b1347b0fbf4 (diff) | |
download | PeerTube-ee7c25c767c357bd12570889f8ccd79ba9ea4eb9.tar.gz PeerTube-ee7c25c767c357bd12570889f8ccd79ba9ea4eb9.tar.zst PeerTube-ee7c25c767c357bd12570889f8ccd79ba9ea4eb9.zip |
Create new Docker dev image (#1173)
* Move the old dev docker files to support/docker/janitor
* Create new Docker dev image
Diffstat (limited to 'support/docker')
-rw-r--r-- | support/docker/dev/Dockerfile | 48 | ||||
-rw-r--r-- | support/docker/dev/setup_postgres.sql | 6 | ||||
-rw-r--r-- | support/docker/dev/usage.md | 20 | ||||
-rw-r--r-- | support/docker/janitor/Dockerfile | 32 | ||||
-rw-r--r-- | support/docker/janitor/create_user.sql (renamed from support/docker/dev/create_user.sql) | 0 | ||||
-rw-r--r-- | support/docker/janitor/janitor.json (renamed from support/docker/dev/janitor.json) | 0 | ||||
-rw-r--r-- | support/docker/janitor/supervisord.conf (renamed from support/docker/dev/supervisord.conf) | 0 |
7 files changed, 90 insertions, 16 deletions
diff --git a/support/docker/dev/Dockerfile b/support/docker/dev/Dockerfile index 2b4f2b215..aa4a8a3d6 100644 --- a/support/docker/dev/Dockerfile +++ b/support/docker/dev/Dockerfile | |||
@@ -1,32 +1,48 @@ | |||
1 | FROM janitortechnology/ubuntu-dev | 1 | FROM ubuntu:bionic |
2 | |||
3 | # Avoid tzdata interactive dialog | ||
4 | ENV DEBIAN_FRONTEND=noninteractive | ||
2 | 5 | ||
3 | # Install PeerTube's dependencies. | 6 | # Install PeerTube's dependencies. |
4 | # Packages are from https://github.com/Chocobozzz/PeerTube#dependencies | 7 | # Packages are from https://github.com/Chocobozzz/PeerTube#dependencies |
5 | RUN sudo apt-get update -q && sudo apt-get install -qy \ | 8 | RUN apt-get update -q && apt-get install -qy \ |
9 | curl \ | ||
10 | nano \ | ||
6 | ffmpeg \ | 11 | ffmpeg \ |
7 | postgresql \ | 12 | postgresql \ |
8 | openssl | 13 | postgresql-contrib \ |
14 | openssl \ | ||
15 | g++ \ | ||
16 | make \ | ||
17 | redis-server \ | ||
18 | git \ | ||
19 | gnupg | ||
20 | |||
21 | # Install NodeJS 8.x | ||
22 | RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - && \ | ||
23 | apt-get install -y nodejs | ||
24 | |||
25 | # Install Yarn | ||
26 | RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ | ||
27 | echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \ | ||
28 | apt-get update && apt-get install yarn | ||
9 | 29 | ||
10 | # Download PeerTube's source code. | 30 | # Download PeerTube's source code. |
11 | RUN git clone -b develop https://github.com/Chocobozzz/PeerTube /home/user/PeerTube | 31 | RUN git clone -b develop https://github.com/Chocobozzz/PeerTube /home/user/PeerTube |
12 | WORKDIR /home/user/PeerTube | 32 | WORKDIR /home/user/PeerTube |
13 | 33 | ||
14 | # Configure the IDEs to use Janitor's source directory as workspace. | ||
15 | ENV WORKSPACE /home/user/PeerTube/ | ||
16 | |||
17 | # Install dependencies. | 34 | # Install dependencies. |
18 | RUN yarn install --pure-lockfile | 35 | RUN yarn install --pure-lockfile |
19 | 36 | ||
20 | # Configure Janitor for PeerTube. | 37 | # Configure and run PeerTube. |
21 | COPY --chown=user:user janitor.json /home/user/ | 38 | COPY setup_postgres.sql /tmp/ |
39 | RUN service postgresql start \ | ||
40 | && su postgres -c "psql --file=/tmp/setup_postgres.sql" | ||
22 | 41 | ||
23 | # Configure and build PeerTube. | 42 | # Expose PeerTube sources as a volume |
24 | COPY create_user.sql /tmp/ | 43 | VOLUME /home/user/PeerTube |
25 | RUN sudo service postgresql start \ | ||
26 | && sudo -u postgres psql --file=/tmp/create_user.sql \ | ||
27 | && npm run build | ||
28 | |||
29 | COPY --chown=user:user supervisord.conf /tmp/supervisord-extra.conf | ||
30 | RUN cat /tmp/supervisord-extra.conf | sudo tee -a /etc/supervisord.conf | ||
31 | 44 | ||
32 | EXPOSE 3000 9000 | 45 | EXPOSE 3000 9000 |
46 | |||
47 | # Start PostgreSQL and Redis | ||
48 | CMD service postgresql start && redis-server | ||
diff --git a/support/docker/dev/setup_postgres.sql b/support/docker/dev/setup_postgres.sql new file mode 100644 index 000000000..0937f9d19 --- /dev/null +++ b/support/docker/dev/setup_postgres.sql | |||
@@ -0,0 +1,6 @@ | |||
1 | create database peertube_dev; | ||
2 | create user peertube password 'peertube'; | ||
3 | grant all privileges on database peertube_dev to peertube; | ||
4 | \c peertube_dev | ||
5 | CREATE EXTENSION pg_trgm; | ||
6 | CREATE EXTENSION unaccent; | ||
diff --git a/support/docker/dev/usage.md b/support/docker/dev/usage.md new file mode 100644 index 000000000..319d7db30 --- /dev/null +++ b/support/docker/dev/usage.md | |||
@@ -0,0 +1,20 @@ | |||
1 | ### Usage | ||
2 | 1. Build the image: | ||
3 | ``` | ||
4 | docker build -t my_peertube_dev . | ||
5 | ``` | ||
6 | 1. Start the container: | ||
7 | ``` | ||
8 | docker run -d -i -p 3000:3000 -p 9000:9000 --name peertube my_peertube_dev | ||
9 | ``` | ||
10 | This will create a new Docker volume containing PeerTube sources. | ||
11 | |||
12 | 1. Start PeerTube inside the container: | ||
13 | ``` | ||
14 | docker exec -it peertube npm run dev | ||
15 | ``` | ||
16 | 1. In another window, find the path to the Docker volume | ||
17 | ``` | ||
18 | docker inspect peertube | less +/Mounts | ||
19 | ``` | ||
20 | You can now make changes to the files. They should be automatically recompiled. | ||
diff --git a/support/docker/janitor/Dockerfile b/support/docker/janitor/Dockerfile new file mode 100644 index 000000000..2b4f2b215 --- /dev/null +++ b/support/docker/janitor/Dockerfile | |||
@@ -0,0 +1,32 @@ | |||
1 | FROM janitortechnology/ubuntu-dev | ||
2 | |||
3 | # Install PeerTube's dependencies. | ||
4 | # Packages are from https://github.com/Chocobozzz/PeerTube#dependencies | ||
5 | RUN sudo apt-get update -q && sudo apt-get install -qy \ | ||
6 | ffmpeg \ | ||
7 | postgresql \ | ||
8 | openssl | ||
9 | |||
10 | # Download PeerTube's source code. | ||
11 | RUN git clone -b develop https://github.com/Chocobozzz/PeerTube /home/user/PeerTube | ||
12 | WORKDIR /home/user/PeerTube | ||
13 | |||
14 | # Configure the IDEs to use Janitor's source directory as workspace. | ||
15 | ENV WORKSPACE /home/user/PeerTube/ | ||
16 | |||
17 | # Install dependencies. | ||
18 | RUN yarn install --pure-lockfile | ||
19 | |||
20 | # Configure Janitor for PeerTube. | ||
21 | COPY --chown=user:user janitor.json /home/user/ | ||
22 | |||
23 | # Configure and build PeerTube. | ||
24 | COPY create_user.sql /tmp/ | ||
25 | RUN sudo service postgresql start \ | ||
26 | && sudo -u postgres psql --file=/tmp/create_user.sql \ | ||
27 | && npm run build | ||
28 | |||
29 | COPY --chown=user:user supervisord.conf /tmp/supervisord-extra.conf | ||
30 | RUN cat /tmp/supervisord-extra.conf | sudo tee -a /etc/supervisord.conf | ||
31 | |||
32 | EXPOSE 3000 9000 | ||
diff --git a/support/docker/dev/create_user.sql b/support/docker/janitor/create_user.sql index c2fbcf27e..c2fbcf27e 100644 --- a/support/docker/dev/create_user.sql +++ b/support/docker/janitor/create_user.sql | |||
diff --git a/support/docker/dev/janitor.json b/support/docker/janitor/janitor.json index 5acdf3060..5acdf3060 100644 --- a/support/docker/dev/janitor.json +++ b/support/docker/janitor/janitor.json | |||
diff --git a/support/docker/dev/supervisord.conf b/support/docker/janitor/supervisord.conf index b2e1682df..b2e1682df 100644 --- a/support/docker/dev/supervisord.conf +++ b/support/docker/janitor/supervisord.conf | |||