You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
2.5 KiB

  1. FROM alpine:3.14 AS common
  2. RUN apk add gnupg ffmpeg
  3. # Add peertube user
  4. RUN addgroup -S peertube && \
  5. adduser -S -G peertube -h /var/lib/peertube peertube
  6. FROM common AS builder
  7. ##
  8. ## Download target release
  9. ##
  10. ENV PEERTUBE_RELEASE=v3.3.0
  11. RUN apk add wget
  12. RUN mkdir -p /opt/apps/peertube && \
  13. cd /opt/apps/peertube && \
  14. wget https://github.com/Chocobozzz/PeerTube/releases/download/${PEERTUBE_RELEASE}/peertube-${PEERTUBE_RELEASE}.tar.xz && \
  15. tar -xJf peertube-${PEERTUBE_RELEASE}.tar.xz && \
  16. rm peertube-${PEERTUBE_RELEASE}.tar.xz && \
  17. mv peertube-${PEERTUBE_RELEASE}/* . && \
  18. rmdir peertube-${PEERTUBE_RELEASE} && \
  19. mkdir -p /etc/peertube /var/lib/peertube && \
  20. ln -sf /var/lib/peertube /opt/apps/peertube/storage
  21. RUN apk add yarn ## Build command
  22. RUN apk add git build-base python3 bash && \
  23. ln -sf /usr/bin/python3 /usr/local/bin/python ## Build deps
  24. RUN chown -R peertube:peertube /opt/apps/peertube
  25. RUN apk add npm ## only needed to install things that should be in yarn
  26. USER peertube
  27. RUN cd /opt/apps/peertube && \
  28. yarn install --production --pure-lockfile && \
  29. yarn cache clean
  30. ## XXXvlab: without this in current docker version, it'll
  31. ## permeate in next image to be built.
  32. USER root
  33. # RUN apk add nodejs yarn
  34. #
  35. ## Source build (very long)
  36. #
  37. # ## To download source
  38. # RUN apk add git
  39. # RUN git clone https://github.com/chocobozzz/PeerTube /tmp/peertube --depth 1
  40. # ## for installation of dependencies
  41. # RUN apk add build-base python
  42. # RUN cd /tmp/peertube && \
  43. # yarn install --pure-lockfile
  44. # ## for scripts run by ``npm run build``
  45. # RUN apk add bash
  46. # RUN cd /tmp/peertube && \
  47. # npm run build
  48. # RUN cd /tmp/peertube && \
  49. # rm -r ./node_modules ./client/node_modules && \
  50. # yarn install --pure-lockfile --production && \
  51. # yarn cache clean
  52. FROM common
  53. # Install PeerTube
  54. COPY --from=builder /opt/apps/peertube /opt/apps/peertube
  55. # RUN mkdir -p /var/lib/peertube /etc/peertube && \
  56. # chown -R peertube:peertube /var/lib/peertube /etc/peertube
  57. # ENV PEERTUBE_APP_DIR=/opt/apps/peertube
  58. # ENV PEERTUBE_DATA_DIR=/var/lib/peertube
  59. ## This is important to set config dir of peertube
  60. ENV NODE_CONFIG_DIR=/etc/peertube
  61. ENV NODE_ENV=prod
  62. VOLUME /var/lib/peertube
  63. VOLUME /etc/peertube
  64. EXPOSE 9000
  65. RUN apk add nodejs npm
  66. ## runtime deps
  67. RUN apk add openssl
  68. ## to check if postgres is fine BEFORE running the app
  69. RUN apk add postgresql-client
  70. COPY src/ .
  71. USER peertube
  72. WORKDIR /opt/apps/peertube
  73. CMD ["/entrypoint.sh"]