1
0

Dockerfile 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. FROM composer:1.7 as php-build
  2. RUN apk add git
  3. RUN adduser -S dev
  4. RUN mkdir /koel && chown dev /koel
  5. WORKDIR /koel
  6. USER dev
  7. ENV KOEL_VERSION 3.7.2
  8. RUN git clone --recurse-submodules --quiet \
  9. --branch "v${KOEL_VERSION}" \
  10. https://github.com/phanan/koel .
  11. RUN composer install --no-interaction
  12. FROM node:8.12.0-alpine as js-build
  13. # gyp verb `which` failed Error: not found: python2
  14. # gyp verb `which` failed at getNotFoundError (/koel/node_modules/which/which.js:13:12)
  15. # ...
  16. # gyp verb `which` failed at FSReqWrap.oncomplete (fs.js:154:21)
  17. RUN apk add python2 make g++
  18. RUN adduser -S dev
  19. USER dev
  20. COPY --from=php-build --chown=dev:nogroup /koel /koel
  21. WORKDIR /koel
  22. RUN yarn install
  23. FROM php:7.2.10-apache-stretch
  24. RUN find / -xdev -type f -perm /u+s -exec chmod --changes u-s {} \; \
  25. && find / -xdev -type f -perm /g+s -exec chmod --changes g-s {} \;
  26. # libpq-dev: required for build of pdo_pgsql (includes libpq-fe.h)
  27. # zlib1g-dev: required by zip module
  28. RUN apt-get update && apt-get install --yes \
  29. libpq-dev \
  30. zlib1g-dev
  31. RUN docker-php-ext-install -j$(nproc) \
  32. exif \
  33. pdo_pgsql \
  34. zip
  35. # AH00100: apache2: could not log pid to file
  36. RUN sed --in-place '/^PidFile /d' /etc/apache2/apache2.conf
  37. RUN find /etc/apache2/sites-enabled -name '*.conf' -delete
  38. RUN echo >/etc/apache2/ports.conf
  39. RUN a2enmod headers rewrite
  40. # TODO replace /etc/apache2/apache2.conf
  41. COPY ./apache2-koel.conf /etc/apache2/
  42. RUN echo "Include /etc/apache2/apache2-koel.conf" >>/etc/apache2/apache2.conf
  43. EXPOSE 8080
  44. COPY --from=js-build /koel /koel
  45. WORKDIR /koel
  46. # TODO chown on entire ./storage ?
  47. RUN mkdir ./storage/logs \
  48. && chown --changes www-data ./storage/logs \
  49. && chown --changes --recursive www-data ./storage/framework
  50. # TODO production php.ini
  51. # TODO run as non-root
  52. COPY ./run-koel.sh /
  53. CMD ["/run-koel.sh"]