add docker file working

(sugestion by @slamora)
This commit is contained in:
RubenPX 2022-03-18 17:21:05 +01:00
parent b83f369ea3
commit ebd96b710e
3 changed files with 18 additions and 44 deletions

View file

@ -1,36 +0,0 @@
FROM debian:stable-slim
CMD [ "bash" ]
# Variables de entorno
ENV DB_User="admin"
ENV DB_Email="ad@ad.ad"
ENV DB_Pass="admin"
# Instalar paquetes necesarios
RUN apt-get update
RUN apt-get install --no-install-recommends -y git python3-pip python3-setuptools python3-venv python3
# Creamos un usuario (django-orchestra no se ejecutará si somos root)
RUN useradd -ms /bin/bash -d /home/Ouser Ouser
USER Ouser
WORKDIR /home/Ouser/django
# Creamos el entorno de desarollo
ENV VENV_FOLDER=/home/Ouser/.venv
RUN python3 -m venv ${VENV_FOLDER}
RUN chmod +x ${VENV_FOLDER}/bin/activate
RUN . ${VENV_FOLDER}/bin/activate
# Instalamos django-admin y sus dependencias
RUN pip install wheel
COPY . .
RUN ${VENV_FOLDER}/bin/pip install -r requirements.txt
RUN ${VENV_FOLDER}/bin/pip install -e .
# Creamos el panel
# RUN [ "/bin/bash", "./.docker/setup.sh" ]
# Establacamos el punto de entrada de el contenedor de docker
ENTRYPOINT ["sh", "-c", "tail -f /dev/null"]
# ENTRYPOINT [ "./.docker/entrypoint.sh" ]

View file

@ -1,7 +1,7 @@
version: "3.9"
services:
web:
tty: true
orchestra:
tty: false
build: .
ports:
- "9999:9999"

View file

@ -1,7 +1,10 @@
FROM debian:stable-slim
RUN apt-get -y update && apt-get install -y curl sudo git python3 python3-pip
RUN pip3 install -r https://raw.githubusercontent.com/ribaguifi/django-orchestra/master/requirements.txt
RUN apt-get -y update && apt-get install -y curl sudo git python3 python3-pip python3-setuptools python3-venv --no-install-recommends
RUN python3 -m venv /opt/venv
RUN . /opt/venv/bin/activate && pip install wheel
RUN . /opt/venv/bin/activate && pip3 install -r https://raw.githubusercontent.com/ribaguifi/django-orchestra/master/requirements.txt
RUN useradd orchestra --shell /bin/bash && { echo "orchestra:orchestra" | chpasswd; } && mkhomedir_helper orchestra && adduser orchestra sudo
RUN echo 'EXPORT $PATH="$PATH:/home/orchestra/.local/bin/"' > /home/orchestra/.bashrc
RUN apt-get clean
@ -9,10 +12,17 @@ RUN apt-get clean
WORKDIR /home/orchestra
COPY . .
RUN pip3 install -r requirements.txt
RUN pip3 install -e .
RUN . /opt/venv/bin/activate && pip install -r requirements.txt
RUN . /opt/venv/bin/activate && pip install -e .
USER orchestra
RUN orchestra-admin startproject panel
RUN . /opt/venv/bin/activate && django-admin startproject panel --template="/home/orchestra/orchestra/conf/project_template"
ENTRYPOINT ["sh", "-c", "tail -f /dev/null"]
WORKDIR /home/orchestra/panel
RUN . /opt/venv/bin/activate && python manage.py migrate --no-input
RUN export DJANGO_SUPERUSER_PASSWORD=admin && . /opt/venv/bin/activate && python manage.py createsuperuser --username admin --email test@example.org --no-input
EXPOSE 9999
ENTRYPOINT . /opt/venv/bin/activate && python manage.py runserver 0.0.0.0:9999