2
1

Dockerfile.stretch 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. FROM node:10-stretch
  2. # Allow to pass extra options to the npm run build
  3. # eg: --light --light-fr to not build all client languages
  4. # (speed up build time if i18n is not required)
  5. ARG NPM_RUN_BUILD_OPTS
  6. RUN set -ex; \
  7. if ! command -v gpg > /dev/null; then \
  8. apt update; \
  9. apt install -y --no-install-recommends \
  10. gnupg \
  11. dirmngr \
  12. ; \
  13. rm -rf /var/lib/apt/lists/*; \
  14. fi
  15. # Install dependencies
  16. RUN apt update \
  17. && apt -y install ffmpeg \
  18. && rm /var/lib/apt/lists/* -fR
  19. # Add peertube user
  20. RUN groupadd -r peertube \
  21. && useradd -r -g peertube -m peertube
  22. # grab gosu for easy step-down from root
  23. RUN set -eux; \
  24. apt update; \
  25. apt install -y gosu; \
  26. rm -rf /var/lib/apt/lists/*; \
  27. gosu nobody true
  28. # Install PeerTube
  29. WORKDIR /app
  30. COPY . ./
  31. RUN chown -R peertube:peertube /app
  32. USER peertube
  33. RUN yarn install --pure-lockfile \
  34. && npm run build -- $NPM_RUN_BUILD_OPTS \
  35. && rm -r ./node_modules ./client/node_modules \
  36. && yarn install --pure-lockfile --production \
  37. && yarn cache clean
  38. USER root
  39. RUN mkdir /data /config
  40. RUN chown -R peertube:peertube /data /config
  41. ENV NODE_ENV production
  42. ENV NODE_CONFIG_DIR /config
  43. VOLUME /data
  44. VOLUME /config
  45. COPY ./support/docker/production/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
  46. ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
  47. # Run the application
  48. CMD ["npm", "start"]
  49. EXPOSE 9000