FROM debian:stretch-slim ARG PEERTUBE_VER=v2.0.0 ARG NPM_RUN_BUILD_OPTS ENV UID=991 \ GID=991 \ FORCE_CHOWN=false \ NODE_ENV=production \ NODE_CONFIG_DIR=/config RUN groupadd -g 991 peertube && useradd -u 991 -g 991 --create-home peertube \ && apt-get update \ && apt-get -y --no-install-recommends install curl gnupg ca-certificates \ && 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 - \ && 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 \ && apt-get -y --no-install-recommends install nodejs yarn curl gnupg dirmngr ffmpeg openssl git build-essential \ && apt-get clean \ && echo "****** Clone Peertube ******" \ && git clone --branch ${PEERTUBE_VER} https://github.com/Chocobozzz/PeerTube /app \ && echo "****** chown ******" \ && chown -R peertube:peertube /app \ && cd /app \ && echo "****** run yarn install as user ******" \ && su - peertube -c "cd /app && yarn install --pure-lockfile" \ && echo "****** run npm install as user ******" \ && su - peertube -c "cd /app && npm run build -- $NPM_RUN_BUILD_OPTS && rm -r ./node_modules ./client/node_modules " \ && echo "****** run yarn install as user ******" \ && su - peertube -c "cd /app && yarn install --pure-lockfile --production && yarn cache clean" \ && apt-get remove --purge --yes build-essential curl git \ && apt-get autoremove -y \ && apt-get clean \ && rm -rf /app/.git \ && rm -rf /tmp/* /var/lib/apt/lists/* /var/cache/debconf/*-old \ && rm -rf /usr/share/man/?? \ && rm -rf /usr/share/man/??_* \ && mkdir {/data,/config} \ && chown -R peertube:peertube /data /config WORKDIR /app/ VOLUME ["/data", "/config"] EXPOSE 9000 COPY ./support/docker/production/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] CMD ["npm", "start"]