diff --git a/docker/Dockerfile-django2 b/docker/Dockerfile-django2 new file mode 100644 index 0000000..bea110a --- /dev/null +++ b/docker/Dockerfile-django2 @@ -0,0 +1,36 @@ +FROM python:3.8 + +RUN apt-get update && apt-get install -y \ + default-mysql-client \ + git \ + nano \ + vim + +# Get IRAP self signed certificate +RUN echo | openssl s_client -connect gitlab.irap.omp.eu:443 -servername gitlab.irap.omp.eu 2>/dev/null | openssl x509 > /etc/ssl/certs/gitlab.irap.omp.eu.crt + + +# adding new user (pyros_user) and creating his home folder +RUN useradd --create-home --shell /bin/bash pyros_user + +# Create the work dir and set permissions as pyros_user +RUN mkdir -p /home/pyros_user/app/ && chown -R pyros_user:pyros_user /home/pyros_user/app +WORKDIR /home/pyros_user/app + +# switch from root to pyros_user +USER pyros_user + +RUN pip install --user --upgrade pip +RUN pip install --user wheel +RUN pip install --user numpy +# copy local host machine files to image +COPY --chown=pyros_user:pyros_user . . + +# adding local/bin to path to avoid pip warning +ENV PATH "$PATH:/home/pyros_user/.local/bin" + +# installing click on the image to prevent error on the first execution of the installation script +RUN pip install --user click + +# installing packages required for PyROS +RUN pip install --user -r ./install/requirements_django2.txt \ No newline at end of file diff --git a/docker/PYROS_DOCKER_BUILD.sh b/docker/PYROS_DOCKER_BUILD.sh index 8c60ecd..da3f587 100755 --- a/docker/PYROS_DOCKER_BUILD.sh +++ b/docker/PYROS_DOCKER_BUILD.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash [ ! -d "../vendor/guitastro/" ] && git clone https://gitlab.irap.omp.eu/guitastrolib/guitastro.git ../vendor/guitastro/ diff --git a/docker/PYROS_DOCKER_START.sh b/docker/PYROS_DOCKER_START.sh index a143a4e..60ade66 100755 --- a/docker/PYROS_DOCKER_START.sh +++ b/docker/PYROS_DOCKER_START.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + # We need these variables for the build and when we launch the containers # But then, we do not need them anymore. Anyway they are referenced in the docker-compose.yml but it does not find them in memory => makes a warning when using the containers... export CURRENT_UID=$(id -u) @@ -10,9 +12,9 @@ docker compose down --remove-orphans echo echo "Then START:" # Take docker-compose.yml folder name ("docker") as containers group name in Docker Desktop by default -#docker compose up -d +docker compose up -d # Change this group name with -p option -docker compose -p pyros-app up -d +#docker compose -p pyros-app up -d # See started containers echo diff --git a/docker/PYROS_DOCKER_STOP.bat b/docker/PYROS_DOCKER_STOP.bat index 7ac9bb4..965cc47 100755 --- a/docker/PYROS_DOCKER_STOP.bat +++ b/docker/PYROS_DOCKER_STOP.bat @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + export CURRENT_UID=$(id -u) docker compose down -- libgit2 0.21.2