This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
idhub-docker/docker/orchestra.Dockerfile

127 lines
4.0 KiB
Docker
Raw Normal View History

FROM debian:bullseye-slim
# based on https://github.com/glic3rinu/django-orchestra/blob/master/INSTALL.md
# HOW TO RUN THIS
#
# 0. rsync -avhP root@109.69.8.140:/opt/orchestra orchestra
# 1. copy this Dockerfile into a dir containing orchestra, like:
# $ ls
# Dockerfile orchestra
# 2. docker build -f orchestra .
# 3. docker rm orchestra; docker run -v /Users/maymerichgubern/orchestra/orchestra/:/opt/orchestra -p 8443:443 -p 8080:80 -it --name orchestra orchestra bash
# 4. sed -i "s/ALLOWED_HOSTS = .*/ALLOWED_HOSTS = ('orchestra.pangea.org', 'localhost')/" panel/settings.py
# 5. service postgresql start; service uwsgi start; service nginx start
# 6. goto https://localhost:8443/admin/
#RUN apt-get update -y && apt-get upgrade -y
RUN apt update && apt-get install -y \
python3-minimal \
python3-pip \
postgresql \
python3-psycopg2 \
cron \
nginx-full \
uwsgi \
uwsgi-plugin-python3 \
sudo \
ca-certificates \
gettext \
bind9utils \
wget \
expect \
wkhtmltopdf \
procps \
net-tools \
ssh \
wkhtmltopdf \
xvfb \
python3-minimal \
python3-dev \
zlib1g-dev \
libcrack2-dev \
libxml2-dev \
libxslt1-dev \
python-is-python3
# Clean up to reduce image size
RUN apt clean && rm -rf /var/lib/apt/lists/*
# celery pinned because big changes on periodic_tasks related API
# celery3.1 wont support > python3.9 (dependency with celery should be removed), celery3.1 won't support django4.0
# orchestra initially was using celery to run async tasks, but then switched to process/threads without MQ... but the dependency with celery was never fully removed :(
# django-iban wont support > 4.0 (django-iban is deprecated, replace by django-localflavor)
# django 3 cannot work https://stackoverflow.com/questions/59261254/no-module-named-django-contrib-staticfiles-templatetags
# RUN pip3 install \
# django==3.2.18 \
# django-fluent-dashboard \
# django-admin-tools \
# django-extensions \
# celery==3.1.23 \
# django-celery==3.3.1 \
# django-cors-headers \
# Markdown \
# djangorestframework \
# ecdsa \
# Pygments \
# django-filter \
# jsonfield \
# python-dateutil \
# https://github.com/glic3rinu/passlib/archive/master.zip \
# django-iban \
# requests \
# phonenumbers \
# django-countries \
# django-localflavor \
# amqp \
# pytz \
# cracklib \
# lxml
# this is to ensure django project is created on top of this working directory
WORKDIR /opt/orchestra/
# TODO maybe from here goes to docker entrypoint?
# TODO assumes that the project already exists, and in some cases that would be interesting
COPY django-orchestra/requirements.txt .
# TODO fix this better in the repo itself
RUN pip3 install -r requirements.txt
RUN pip3 install lxml==4.9.3
COPY django-orchestra .
#RUN sed -i 's/lxml==3.3.5/lxml==4.9.3/' requirements.txt
# solves "No module named 'orchestra'"
RUN pip install -e .
RUN django-admin startproject panel --template=/opt/orchestra/orchestra/conf/project_template/
RUN adduser orchestra \
&& sudo adduser orchestra sudo \
&& su - orchestra
ENV PATH=$PATH:/opt/orchestra/django-orchestra/orchestra/bin
WORKDIR /opt/orchestra/panel
COPY docker/orchestra.migrate.exp /opt/orchestra/panel
COPY docker/orchestra.entrypoint.sh .
ENTRYPOINT sh ./orchestra.entrypoint.sh
# RUN expect -f ./orchestra.migrate.exp
#
# #RUN sed -i "s/'HOST': '',/'HOST': '*',/" panel/settings.py
# RUN sed -i "s/^ALLOWED_HOSTS = \[\]/ALLOWED_HOSTS = \['*'\]/" panel/settings.py
# CMD ./manage.py runserver 0.0.0.0:9080
# EXPOSE 9080:9080
#RUN echo /opt/orchestra/django-orchestra/ > /usr/local/lib/python3.9/dist-packages/orchestra.pth
# TODO move this to entrypoint, with fakedata
# && su postgres bash -c 'psql -f <(zcat /opt/orchestra/orchestra_db_20230907.sql)' \
#RUN service postgresql start \
# && python3 manage.py setupnginx --user orchestra \
# && su orchestra bash -c 'python3 manage.py setupcronbeat' \
# && su orchestra bash -c 'python3 manage.py syncperiodictasks'