wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \
wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \
export GNUPGHOME="$(mktemp -d)"; \
- gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \
+ for server in $(shuf -e ha.pool.sks-keyservers.net \
+ hkp://p80.pool.sks-keyservers.net:80 \
+ keyserver.ubuntu.com \
+ hkp://keyserver.ubuntu.com:80 \
+ pgp.mit.edu) ; do \
+ gpg --keyserver "$server" --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 && break || : ; \
+ done; \
gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \
rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc; \
chmod +x /usr/local/bin/gosu; \
\
apt-get purge -y --auto-remove wget
-# Download the latest version
-RUN git clone https://github.com/Chocobozzz/PeerTube /app \
- && chown -R peertube:peertube /app
-
# Install PeerTube
-USER peertube
WORKDIR /app
+RUN chown peertube:peertube /app
+
+COPY --chown=peertube:peertube . ./
+
+USER peertube
RUN yarn install --pure-lockfile \
&& npm run build
ENV NODE_CONFIG_DIR /app/support/docker/production/config
USER root
-RUN mkdir /data && chown peertube:peertube /data
+RUN mkdir /data
VOLUME /data
-COPY docker-entrypoint.sh /usr/local/bin/
-ENTRYPOINT ["docker-entrypoint.sh"]
+COPY ./support/docker/production/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
+ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
# Run the application
CMD ["npm", "start"]
# first arg is `-f` or `--some-option`
# or first arg is `something.conf`
if [ "${1#-}" != "$1" ] || [ "${1%.conf}" != "$1" ]; then
- set -- npm "$@"
+ set -- npm "$@"
fi
# allow the container to be started with `--user`
-if [ "$1" = 'npm' -a "$(id -u)" = '0' ]; then
- chown -R peertube: /data
- exec gosu peertube "$0" "$@"
+if [ "$1" = 'npm' -a "$(id -u)" != '0' ]; then
+ chown -R peertube:peertube /data
+ exec gosu peertube "$0" "$@"
fi
exec "$@"