108 lines
2.5 KiB

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