Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADD django_sp in Docker-compose and revisited CI workflow #97

Merged
merged 5 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*
# Add exception for the directories you actually want to include in the context
!example
!example_sp
!requirements.txt
!oids.conf
!build_spid_certs.sh
21 changes: 4 additions & 17 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,20 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies
run: |
sudo apt update
sudo apt install -y libffi-dev libssl-dev python3-pip xmlsec1 procps libpcre3 libpcre3-dev
- name: Install dependencies
run: |
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install -r example_sp/djangosaml2_sp/requirements.txt
pip install spid-sp-test>=1.2.8
pip install flake8
pip install satosa_oidcop>=1.0
- name: Lint with flake8
run: |
## stop the build if there are Python syntax errors or undefined names
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: run djangosaml2 SP
run: |
cd example_sp/djangosaml2_sp/
bash run.sh &
sleep 5
- name: docker compose
run: |
cd Docker-compose
docker compose -f docker-compose.yml up -d
- name: djangosaml2 SP metadata to Proxy
peppelinux marked this conversation as resolved.
Show resolved Hide resolved
run: |
wget http://localhost:8000/saml2/metadata -O example/metadata/sp/djangosaml2_sp.xml
Expand All @@ -61,10 +52,6 @@ jobs:
cd docker-example
mkdir -p metadata/idp
mkdir -p metadata/sp
- name: docker compose
run: |
cd Docker-compose
docker compose -f docker-compose.yml up -d
- name: Metadata proxy to djangosaml2 SP
run: |
wget --no-check-certificate https://localhost/Saml2IDP/metadata -O example_sp/djangosaml2_sp/saml2_sp/saml2_config/satosa-saml2spid.xml
Expand Down
28 changes: 26 additions & 2 deletions Docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@ services:

satosa-saml2spid:
#image: ghcr.io/italia/satosa-saml2spid:latest
image: satosa-saml2spid:latest
build: ../
#image: satosa-saml2spid:latest
build:
context: ../
args:
- NODE_ENV=local
dockerfile: satosa.Dockerfile
container_name: satosa-saml2spid
depends_on:
- satosa-mongo
Expand Down Expand Up @@ -109,6 +113,26 @@ 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
Expand Down
19 changes: 19 additions & 0 deletions example_sp/django.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM alpine:3.18
ENV BASEDIR="/django_sp"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

peppelinux marked this conversation as resolved.
Show resolved Hide resolved
COPY djangosaml2_sp/requirements.txt /


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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
&& 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
3 changes: 3 additions & 0 deletions example_sp/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pip3 install -r ../requirements.txt --ignore-installed --root-user-action=ignore
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pip3 install -r ../requirements.txt --ignore-installed --root-user-action=ignore

cd djangosaml2_sp
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cd djangosaml2_sp

python -B ./manage.py runserver 0.0.0.0:8000
File renamed without changes.
Loading