This repository has been archived on 2021-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
docker-peertube/Dockerfile

55 lines
2.0 KiB
Docker
Raw Permalink Normal View History

2019-11-16 11:12:52 +01:00
FROM debian:stretch-slim
2017-11-03 14:39:41 +01:00
2019-11-16 10:33:15 +01:00
ARG PEERTUBE_VER=v2.0.0
2019-11-16 10:49:03 +01:00
ARG NPM_RUN_BUILD_OPTS
ENV UID=991 \
GID=991 \
FORCE_CHOWN=false \
NODE_ENV=production \
NODE_CONFIG_DIR=/config
2018-01-18 08:35:11 +01:00
2017-11-03 14:39:41 +01:00
2018-01-03 14:31:32 +01:00
RUN groupadd -g 991 peertube && useradd -u 991 -g 991 --create-home peertube \
2019-11-16 11:12:52 +01:00
&& apt-get update \
&& apt-get -y --no-install-recommends install curl gnupg ca-certificates \
2019-11-16 10:33:15 +01:00
&& echo "deb http://ftp.debian.org/debian bullseye-backports main contrib non-free" >> /etc/apt/sources.list \
&& curl -sL https://deb.nodesource.com/setup_10.x | bash - \
2017-11-03 14:39:41 +01:00
&& 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 \
2019-11-16 10:49:03 +01:00
&& apt-get -y --no-install-recommends install nodejs yarn curl gnupg dirmngr ffmpeg openssl git build-essential \
2019-11-16 10:33:15 +01:00
&& apt-get clean \
2018-01-03 13:48:01 +01:00
&& echo "****** Clone Peertube ******" \
2019-11-16 10:49:03 +01:00
&& git clone --branch ${PEERTUBE_VER} https://github.com/Chocobozzz/PeerTube /app \
2018-01-03 13:48:01 +01:00
&& echo "****** chown ******" \
2019-11-16 10:49:03 +01:00
&& chown -R peertube:peertube /app \
&& cd /app \
2019-11-16 11:12:52 +01:00
&& echo "****** run yarn install as user ******" \
&& su - peertube -c "cd /app && yarn install --pure-lockfile" \
2018-01-03 13:48:01 +01:00
&& echo "****** run npm install as user ******" \
2019-11-16 10:49:03 +01:00
&& su - peertube -c "cd /app && npm run build -- $NPM_RUN_BUILD_OPTS && rm -r ./node_modules ./client/node_modules " \
2018-01-18 08:35:11 +01:00
&& echo "****** run yarn install as user ******" \
2019-11-16 10:49:03 +01:00
&& su - peertube -c "cd /app && yarn install --pure-lockfile --production && yarn cache clean" \
2017-11-03 14:39:41 +01:00
&& apt-get remove --purge --yes build-essential curl git \
&& apt-get autoremove -y \
&& apt-get clean \
2019-11-16 10:49:03 +01:00
&& rm -rf /app/.git \
2017-11-03 14:39:41 +01:00
&& rm -rf /tmp/* /var/lib/apt/lists/* /var/cache/debconf/*-old \
&& rm -rf /usr/share/man/?? \
2019-11-16 10:33:15 +01:00
&& rm -rf /usr/share/man/??_* \
2019-11-16 11:56:00 +01:00
&& mkdir {/data,/config} \
2019-11-16 10:33:15 +01:00
&& chown -R peertube:peertube /data /config
2017-11-03 14:39:41 +01:00
2019-11-16 10:49:03 +01:00
WORKDIR /app/
2017-11-03 14:39:41 +01:00
2019-11-16 10:33:15 +01:00
VOLUME ["/data", "/config"]
2017-11-03 14:39:41 +01:00
2019-11-16 10:33:15 +01:00
EXPOSE 9000
2017-11-29 11:36:46 +01:00
2019-11-16 10:49:03 +01:00
COPY ./support/docker/production/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
2019-11-16 10:33:15 +01:00
2019-11-16 10:49:03 +01:00
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
2017-11-29 11:36:46 +01:00
2019-11-16 10:33:15 +01:00
CMD ["npm", "start"]