aboutsummaryrefslogtreecommitdiffhomepage
path: root/support/docker
diff options
context:
space:
mode:
Diffstat (limited to 'support/docker')
-rw-r--r--support/docker/production/Dockerfile.stretch24
-rw-r--r--support/docker/production/docker-compose.yml3
-rwxr-xr-xsupport/docker/production/docker-entrypoint.sh8
3 files changed, 22 insertions, 13 deletions
diff --git a/support/docker/production/Dockerfile.stretch b/support/docker/production/Dockerfile.stretch
index bf2bae510..5bb67f816 100644
--- a/support/docker/production/Dockerfile.stretch
+++ b/support/docker/production/Dockerfile.stretch
@@ -33,7 +33,13 @@ RUN set -ex; \
33 wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ 33 wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \
34 wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \ 34 wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \
35 export GNUPGHOME="$(mktemp -d)"; \ 35 export GNUPGHOME="$(mktemp -d)"; \
36 gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ 36 for server in $(shuf -e ha.pool.sks-keyservers.net \
37 hkp://p80.pool.sks-keyservers.net:80 \
38 keyserver.ubuntu.com \
39 hkp://keyserver.ubuntu.com:80 \
40 pgp.mit.edu) ; do \
41 gpg --keyserver "$server" --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 && break || : ; \
42 done; \
37 gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ 43 gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \
38 rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc; \ 44 rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc; \
39 chmod +x /usr/local/bin/gosu; \ 45 chmod +x /usr/local/bin/gosu; \
@@ -41,13 +47,13 @@ RUN set -ex; \
41 \ 47 \
42 apt-get purge -y --auto-remove wget 48 apt-get purge -y --auto-remove wget
43 49
44# Download the latest version
45RUN git clone https://github.com/Chocobozzz/PeerTube /app \
46 && chown -R peertube:peertube /app
47
48# Install PeerTube 50# Install PeerTube
49USER peertube
50WORKDIR /app 51WORKDIR /app
52RUN chown peertube:peertube /app
53
54COPY --chown=peertube:peertube . ./
55
56USER peertube
51 57
52RUN yarn install --pure-lockfile \ 58RUN yarn install --pure-lockfile \
53 && npm run build 59 && npm run build
@@ -58,11 +64,11 @@ ENV NODE_ENV production
58ENV NODE_CONFIG_DIR /app/support/docker/production/config 64ENV NODE_CONFIG_DIR /app/support/docker/production/config
59 65
60USER root 66USER root
61RUN mkdir /data && chown peertube:peertube /data 67RUN mkdir /data
62VOLUME /data 68VOLUME /data
63 69
64COPY docker-entrypoint.sh /usr/local/bin/ 70COPY ./support/docker/production/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
65ENTRYPOINT ["docker-entrypoint.sh"] 71ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
66 72
67# Run the application 73# Run the application
68CMD ["npm", "start"] 74CMD ["npm", "start"]
diff --git a/support/docker/production/docker-compose.yml b/support/docker/production/docker-compose.yml
index f273915b9..ac0a3543b 100644
--- a/support/docker/production/docker-compose.yml
+++ b/support/docker/production/docker-compose.yml
@@ -28,6 +28,9 @@ services:
28 traefik.enable: "true" 28 traefik.enable: "true"
29 traefik.frontend.rule: "Host:${PEERTUBE_HOSTNAME}" 29 traefik.frontend.rule: "Host:${PEERTUBE_HOSTNAME}"
30 traefik.port: "9000" 30 traefik.port: "9000"
31 # If you don't want to use a reverse proxy (not suitable for production!)
32 # ports:
33 # - "80:9000"
31 volumes: 34 volumes:
32 - ./data:/data 35 - ./data:/data
33 depends_on: 36 depends_on:
diff --git a/support/docker/production/docker-entrypoint.sh b/support/docker/production/docker-entrypoint.sh
index 79f0e60f6..4099a1984 100755
--- a/support/docker/production/docker-entrypoint.sh
+++ b/support/docker/production/docker-entrypoint.sh
@@ -4,13 +4,13 @@ set -e
4# first arg is `-f` or `--some-option` 4# first arg is `-f` or `--some-option`
5# or first arg is `something.conf` 5# or first arg is `something.conf`
6if [ "${1#-}" != "$1" ] || [ "${1%.conf}" != "$1" ]; then 6if [ "${1#-}" != "$1" ] || [ "${1%.conf}" != "$1" ]; then
7 set -- npm "$@" 7 set -- npm "$@"
8fi 8fi
9 9
10# allow the container to be started with `--user` 10# allow the container to be started with `--user`
11if [ "$1" = 'npm' -a "$(id -u)" = '0' ]; then 11if [ "$1" = 'npm' -a "$(id -u)" != '0' ]; then
12 chown -R peertube: /data 12 chown -R peertube:peertube /data
13 exec gosu peertube "$0" "$@" 13 exec gosu peertube "$0" "$@"
14fi 14fi
15 15
16exec "$@" 16exec "$@"