diff --git a/.dockerignore b/.dockerignore index 0bc1338a..def51c99 100644 --- a/.dockerignore +++ b/.dockerignore @@ -5,4 +5,4 @@ !example_sp !requirements.txt !oids.conf -!build_spid_certs.sh +!build_spid_certs.sh \ No newline at end of file diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index cae9c8ab..58add00e 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -36,6 +36,10 @@ jobs: flake8 --count --select=E9,F63,F7,F82 --show-source --statistics example ## exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 --max-line-length 120 --count --exit-zero --statistics example + - name: Create docker-example folder + run: | + mkdir -p docker-example + cp -r example/. docker-example - name: docker compose run: | cd Docker-compose @@ -43,10 +47,6 @@ jobs: - name: djangosaml2 SP metadata to Proxy run: | wget http://localhost:8000/saml2/metadata -O example/metadata/sp/djangosaml2_sp.xml - - name: Create docker-example folder - run: | - mkdir -p docker-example - cp -r example/. docker-example - name: run satosa-saml2spid run: | cd docker-example diff --git a/Docker-compose/docker-compose.yml b/Docker-compose/docker-compose.yml index bdac19a5..7974a177 100644 --- a/Docker-compose/docker-compose.yml +++ b/Docker-compose/docker-compose.yml @@ -1,6 +1,5 @@ version: '3' services: - satosa-mongo: image: mongo container_name: satosa-mongo @@ -32,7 +31,25 @@ services: ME_CONFIG_MONGODB_URL: mongodb://${MONGO_DBUSER}:${MONGO_DBPASSWORD}@satosa-mongo:27017/ networks: - satosa-saml2spid - + ## START: PARTE NUOVA + django_sp: + build: + context: ../ + args: + - NODE_ENV=local + dockerfile: example_sp/django.Dockerfile + container_name: django_sp + #restart: always + working_dir: /django_sp + entrypoint: "sh ../entrypoint.sh" + volumes: + - /usr/share/zoneinfo/Europe/Rome:/etc/localtime:ro + - ../example_sp/djangosaml2_sp:/django_sp:rw + ports: + - "8000:8000" + networks: + - satosa-saml2spid +## END: PARTE NUOVA satosa-saml2spid: #image: ghcr.io/italia/satosa-saml2spid:latest #image: satosa-saml2spid:latest @@ -113,26 +130,6 @@ services: networks: - satosa-saml2spid - - django_sp: - build: - context: ../ - args: - - NODE_ENV=local - dockerfile: example_sp/django.Dockerfile - container_name: django_sp - #restart: always - working_dir: /django_sp - entrypoint: "sh ./entrypoint.sh" - volumes: - - /usr/share/zoneinfo/Europe/Rome:/etc/localtime:ro - - ../example_sp:/django_sp:rw - ports: - - "8000:8000" - networks: - - satosa-saml2spid - - spid-samlcheck: image: italia/spid-saml-check container_name: spid-samlcheck @@ -153,4 +150,4 @@ volumes: networks: satosa-saml2spid: - name: satosa-saml2spid + name: satosa-saml2spid \ No newline at end of file diff --git a/example_sp/django.Dockerfile b/example_sp/django.Dockerfile index e0292630..a296617a 100644 --- a/example_sp/django.Dockerfile +++ b/example_sp/django.Dockerfile @@ -1,19 +1,19 @@ FROM alpine:3.18 -ENV BASEDIR="/django_sp" + RUN apk update RUN apk add --update --no-cache tzdata RUN cp /usr/share/zoneinfo/Europe/Rome /etc/localtime RUN echo "Europe/Rome" > /etc/timezone RUN apk del tzdata -COPY djangosaml2_sp/requirements.txt / - +COPY example_sp/djangosaml2_sp/requirements.txt / +COPY example_sp/entrypoint.sh / + +WORKDIR /djangosaml2_sp RUN apk add --update xmlsec-dev libffi-dev openssl-dev python3 py3-pip python3-dev procps git openssl build-base gcc wget bash jq yq \ -&& pip3 install --upgrade pip setuptools --root-user-action=ignore \ -&& pip3 install virtualenv - +&& pip3 install --upgrade pip setuptools --root-user-action=ignore + RUN pip list -WORKDIR $BASEDIR/ - + RUN pip3 install -r ../requirements.txt --ignore-installed --root-user-action=ignore \ No newline at end of file diff --git a/example_sp/entrypoint.sh b/example_sp/entrypoint.sh index 465ccbc0..9cd44e1c 100644 --- a/example_sp/entrypoint.sh +++ b/example_sp/entrypoint.sh @@ -1,3 +1,2 @@ -pip3 install -r ../requirements.txt --ignore-installed --root-user-action=ignore -cd djangosaml2_sp -python -B ./manage.py runserver 0.0.0.0:8000 \ No newline at end of file +python -B manage.py migrate +python -B manage.py runserver 0.0.0.0:8000 \ No newline at end of file diff --git a/satosa.Dockerfile b/satosa.Dockerfile index 172c828c..c732fb29 100644 --- a/satosa.Dockerfile +++ b/satosa.Dockerfile @@ -17,7 +17,7 @@ LABEL org.opencontainers.image.authors=$AUTHORS \ org.opencontainers.image.source=$VCS_URL \ org.opencontainers.image.revision=$VCS_REF \ org.opencontainers.image.description="Docker Image di Satosa-Saml2Spid." - + RUN apk update RUN apk add --update --no-cache tzdata RUN cp /usr/share/zoneinfo/Europe/Rome /etc/localtime @@ -29,6 +29,7 @@ RUN apk add mailcap COPY requirements.txt / + ENV BASEDIR="/satosa_proxy" RUN apk add --update xmlsec libffi-dev openssl-dev python3 py3-pip python3-dev procps git openssl build-base gcc wget bash jq yq \ @@ -38,4 +39,4 @@ RUN apk add --update xmlsec libffi-dev openssl-dev python3 py3-pip python3-dev p RUN pip list -WORKDIR $BASEDIR/ +WORKDIR $BASEDIR/ \ No newline at end of file