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.
 
 
 
 
 
 

79 lines
2.6 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.9.12-slim-buster as base
  21. ARG DEBIAN_FRONTEND=noninteractive
  22. RUN apt-get update \
  23. && if [ $(dpkg --print-architecture) = "arm64" -o $(dpkg --print-architecture) = "armhf" ]; then apt-get -y install apt-utils; fi \
  24. && apt-get -y install gcc default-libmysqlclient-dev
  25. RUN pip --no-cache-dir install --user mysqlclient cx-Oracle
  26. # Final image
  27. FROM python:3.9.12-slim-buster
  28. ARG DEBIAN_FRONTEND=noninteractive
  29. WORKDIR pinry
  30. RUN mkdir /data && chown -R www-data:www-data /data
  31. RUN groupadd -g 2300 tmpgroup \
  32. && usermod -g tmpgroup www-data \
  33. && groupdel www-data \
  34. && groupadd -g 1000 www-data \
  35. && usermod -g www-data www-data \
  36. && usermod -u 1000 www-data \
  37. && groupdel tmpgroup
  38. RUN apt-get update \
  39. # Install nginx
  40. && apt-get -y install nginx pwgen \
  41. # Install Pillow dependencies
  42. && apt-get -y install libopenjp2-7 libjpeg-turbo-progs libjpeg62-turbo-dev libtiff5-dev libxcb1 \
  43. # Needed to compile psycopg2 on arm (fallback for psycopg2-binary)
  44. && if [ $(dpkg --print-architecture) = "arm64" -o $(dpkg --print-architecture) = "armhf" ]; then apt-get -y install apt-utils libpq-dev gcc; fi \
  45. && rm -rf /var/lib/apt/lists/* \
  46. && apt-get autoclean
  47. # Install Pipfile requirements
  48. COPY requirements.txt ./
  49. RUN pip install "rcssmin==1.0.6" --install-option="--without-c-extensions" \
  50. && pip install -r requirements.txt
  51. # Copy from previous stages
  52. COPY --from=yarn-build pinry-spa/dist /pinry/pinry-spa/dist
  53. COPY --from=base /root/.local /root/.local
  54. ENV PATH=/root/.local/bin:$PATH
  55. COPY . .
  56. # Load in all of our config files.
  57. ADD docker/nginx/nginx.conf /etc/nginx/nginx.conf
  58. ADD docker/nginx/sites-enabled/default /etc/nginx/sites-enabled/default
  59. # 80 is for nginx web, /data contains static files and database /start runs it.
  60. EXPOSE 80
  61. ENV DJANGO_SETTINGS_MODULE pinry.settings.docker
  62. VOLUME ["/data"]
  63. CMD ["/pinry/docker/scripts/start.sh"]