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.
 
 
 
 
 
 

74 lines
2.1 KiB

  1. # -----------------------------------------------------------------------------
  2. # docker-pinry
  3. #
  4. # Builds a basic docker image that can run Pinry (http://getpinry.com) and serve
  5. # all of it's assets, there are more optimal ways to do this but this is the
  6. # most friendly and has everything contained in a single instance.
  7. #
  8. # Authors: Isaac Bythewood, Jason Kaltsikis
  9. # Updated: May 2nd, 2020
  10. # Require: Docker (http://www.docker.io/)
  11. # -----------------------------------------------------------------------------
  12. # Build static yarn file
  13. FROM node:14-buster as yarn-build
  14. WORKDIR pinry-spa
  15. COPY pinry-spa/package.json pinry-spa/yarn.lock ./
  16. RUN yarn install
  17. COPY pinry-spa .
  18. RUN yarn build
  19. # Required for other database options
  20. FROM python:3.7-slim-buster as base
  21. RUN apt-get update \
  22. && apt-get -y install gcc default-libmysqlclient-dev
  23. RUN pip --no-cache-dir install --user mysqlclient cx-Oracle
  24. # Final image
  25. FROM python:3.7-slim-buster
  26. WORKDIR pinry
  27. RUN mkdir /data && chown -R www-data:www-data /data
  28. RUN groupadd -g 2300 tmpgroup \
  29. && usermod -g tmpgroup www-data \
  30. && groupdel www-data \
  31. && groupadd -g 1000 www-data \
  32. && usermod -g www-data www-data \
  33. && usermod -u 1000 www-data \
  34. && groupdel tmpgroup
  35. # Install nginx
  36. RUN apt-get update \
  37. && apt-get -y install nginx pwgen \
  38. # Install Pillow dependencies
  39. && apt-get -y install libopenjp2-7 libjpeg-turbo-progs libjpeg62-turbo-dev libtiff5-dev libxcb1 \
  40. && rm -rf /var/lib/apt/lists/* \
  41. && apt-get autoclean
  42. # Install Pipfile requirements
  43. COPY Pipfile* ./
  44. RUN pip install rcssmin --install-option="--without-c-extensions" \
  45. && pip install pipenv \
  46. && pipenv install --three --system --clear
  47. # Copy from previous stages
  48. COPY --from=yarn-build pinry-spa/dist /pinry/pinry-spa/dist
  49. COPY --from=base /root/.local /root/.local
  50. ENV PATH=/root/.local/bin:$PATH
  51. COPY . .
  52. # Load in all of our config files.
  53. ADD docker/nginx/nginx.conf /etc/nginx/nginx.conf
  54. ADD docker/nginx/sites-enabled/default /etc/nginx/sites-enabled/default
  55. # 80 is for nginx web, /data contains static files and database /start runs it.
  56. EXPOSE 80
  57. VOLUME ["/data"]
  58. CMD ["/pinry/docker/scripts/start.sh"]