diff options
-rw-r--r-- | .dockerignore | 4 | ||||
-rw-r--r-- | support/docker/production/Dockerfile.stretch | 24 | ||||
-rw-r--r-- | support/docker/production/docker-compose.yml | 3 | ||||
-rwxr-xr-x | support/docker/production/docker-entrypoint.sh | 8 |
4 files changed, 25 insertions, 14 deletions
diff --git a/.dockerignore b/.dockerignore index 1d1cf894a..9a32da269 100644 --- a/.dockerignore +++ b/.dockerignore | |||
@@ -2,9 +2,11 @@ | |||
2 | *.md | 2 | *.md |
3 | .git | 3 | .git |
4 | .github | 4 | .github |
5 | config | ||
6 | support/doc | 5 | support/doc |
7 | support/nginx | 6 | support/nginx |
8 | support/systemd | 7 | support/systemd |
9 | support/docker/*/Dockerfile.* | 8 | support/docker/*/Dockerfile.* |
10 | support/docker/*/*.yml | 9 | support/docker/*/*.yml |
10 | storage | ||
11 | node_modules | ||
12 | client/node_modules | ||
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 | ||
45 | RUN git clone https://github.com/Chocobozzz/PeerTube /app \ | ||
46 | && chown -R peertube:peertube /app | ||
47 | |||
48 | # Install PeerTube | 50 | # Install PeerTube |
49 | USER peertube | ||
50 | WORKDIR /app | 51 | WORKDIR /app |
52 | RUN chown peertube:peertube /app | ||
53 | |||
54 | COPY --chown=peertube:peertube . ./ | ||
55 | |||
56 | USER peertube | ||
51 | 57 | ||
52 | RUN yarn install --pure-lockfile \ | 58 | RUN yarn install --pure-lockfile \ |
53 | && npm run build | 59 | && npm run build |
@@ -58,11 +64,11 @@ ENV NODE_ENV production | |||
58 | ENV NODE_CONFIG_DIR /app/support/docker/production/config | 64 | ENV NODE_CONFIG_DIR /app/support/docker/production/config |
59 | 65 | ||
60 | USER root | 66 | USER root |
61 | RUN mkdir /data && chown peertube:peertube /data | 67 | RUN mkdir /data |
62 | VOLUME /data | 68 | VOLUME /data |
63 | 69 | ||
64 | COPY docker-entrypoint.sh /usr/local/bin/ | 70 | COPY ./support/docker/production/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh |
65 | ENTRYPOINT ["docker-entrypoint.sh"] | 71 | ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] |
66 | 72 | ||
67 | # Run the application | 73 | # Run the application |
68 | CMD ["npm", "start"] | 74 | CMD ["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` |
6 | if [ "${1#-}" != "$1" ] || [ "${1%.conf}" != "$1" ]; then | 6 | if [ "${1#-}" != "$1" ] || [ "${1%.conf}" != "$1" ]; then |
7 | set -- npm "$@" | 7 | set -- npm "$@" |
8 | fi | 8 | fi |
9 | 9 | ||
10 | # allow the container to be started with `--user` | 10 | # allow the container to be started with `--user` |
11 | if [ "$1" = 'npm' -a "$(id -u)" = '0' ]; then | 11 | if [ "$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" "$@" |
14 | fi | 14 | fi |
15 | 15 | ||
16 | exec "$@" | 16 | exec "$@" |