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.
 
 
 
 
 
 

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