diff --git a/borrador-dockerfile b/borrador-dockerfile deleted file mode 100644 index 40b74a7a..00000000 --- a/borrador-dockerfile +++ /dev/null @@ -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" ] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 843ef53b..e10de03f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: "3.9" services: - web: - tty: true + orchestra: + tty: false build: . ports: - "9999:9999" \ No newline at end of file diff --git a/dockerfile b/dockerfile index fd31a961..4b9b9ae2 100644 --- a/dockerfile +++ b/dockerfile @@ -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"] \ No newline at end of file +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 \ No newline at end of file