From c951972520172cb80b56f2c719e1c4e0a7f832b7 Mon Sep 17 00:00:00 2001 From: mattiaBarbo Date: Thu, 25 Jul 2024 11:41:26 +0200 Subject: [PATCH] fixing files --- Dockerfile | 32 ++++--------- SQAaaS/Dockerfile | 33 +++++++++++++ SQAaaS/requirements.txt | 2 + .../script_dockerfile.sh | 0 deploy_service.sh | 29 ++++++++++++ docker-compose.yml | 47 +++++++++++++++++++ requirements.txt | 9 +++- 7 files changed, 126 insertions(+), 26 deletions(-) create mode 100644 SQAaaS/Dockerfile create mode 100644 SQAaaS/requirements.txt rename script_dockerfile.sh => SQAaaS/script_dockerfile.sh (100%) create mode 100644 deploy_service.sh create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile index 7ef22d8..13a3a2f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,33 +1,17 @@ -FROM python:3.9-slim +FROM python:3-alpine -# Install dependencies -RUN apt-get update && apt-get install -y \ - curl \ - git \ - docker.io \ - docker-compose - -# Work Directory WORKDIR /app -# Clean and clone updated GitHub repo -RUN rm -rf /app/* && \ - git clone --branch sqa https://github.com/HPCI-Lab/yProv.git . - -# Install requirements -COPY requirements.txt /app/requirements.txt -RUN pip install -r requirements.txt +RUN python -m pip install --upgrade pip -# Installa le dipendenze -RUN pip install requests -RUN pip install pytest +COPY requirements.txt . -# Make the script_dockerfile.sh script executable and run it -COPY script_dockerfile.sh /app/script_dockerfile.sh -RUN chmod +x /app/script_dockerfile.sh +RUN pip install -r requirements.txt -# Default command to keep the container running -CMD ["tail", "-f", "/dev/null"] +COPY . . +ENV PORT=3000 SCHEME="bolt" ADDRESS='db:7687' +EXPOSE 3000 +CMD [ "python" , "./app.py" ] \ No newline at end of file diff --git a/SQAaaS/Dockerfile b/SQAaaS/Dockerfile new file mode 100644 index 0000000..7ef22d8 --- /dev/null +++ b/SQAaaS/Dockerfile @@ -0,0 +1,33 @@ +FROM python:3.9-slim + +# Install dependencies +RUN apt-get update && apt-get install -y \ + curl \ + git \ + docker.io \ + docker-compose + +# Work Directory +WORKDIR /app + +# Clean and clone updated GitHub repo +RUN rm -rf /app/* && \ + git clone --branch sqa https://github.com/HPCI-Lab/yProv.git . + +# Install requirements +COPY requirements.txt /app/requirements.txt +RUN pip install -r requirements.txt + +# Installa le dipendenze +RUN pip install requests +RUN pip install pytest + +# Make the script_dockerfile.sh script executable and run it +COPY script_dockerfile.sh /app/script_dockerfile.sh +RUN chmod +x /app/script_dockerfile.sh + +# Default command to keep the container running +CMD ["tail", "-f", "/dev/null"] + + + diff --git a/SQAaaS/requirements.txt b/SQAaaS/requirements.txt new file mode 100644 index 0000000..16d3b77 --- /dev/null +++ b/SQAaaS/requirements.txt @@ -0,0 +1,2 @@ +pytest +requests \ No newline at end of file diff --git a/script_dockerfile.sh b/SQAaaS/script_dockerfile.sh similarity index 100% rename from script_dockerfile.sh rename to SQAaaS/script_dockerfile.sh diff --git a/deploy_service.sh b/deploy_service.sh new file mode 100644 index 0000000..f6d1157 --- /dev/null +++ b/deploy_service.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +docker run \ + --name db \ + --network=yprov_net \ + -p 7474:7474 -p 7687:7687 \ + -d \ + -v neo4j_data:/data \ + -v neo4j_logs:/logs \ + -v $HOME/neo4j/import:/var/lib/neo4j/import \ + -v $HOME/neo4j/plugins:/plugins \ + --env NEO4J_AUTH=neo4j/password \ + --env NEO4J_ACCEPT_LICENSE_AGREEMENT=eval \ + -e NEO4J_apoc_export_file_enabled=true \ + -e NEO4J_apoc_import_file_enabled=true \ + -e NEO4J_apoc_import_file_use__neo4j__config=true \ + -e NEO4J_PLUGINS=\[\"apoc\"\] \ + neo4j:enterprise + +docker run \ + --restart on-failure \ + --name web \ + --network=yprov_net \ + -p 3000:3000 \ + -d \ + -v yprov_data:/app/conf \ + --env USER=neo4j \ + --env PASSWORD=password \ + yprov_web \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..2606e52 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,47 @@ +version: "3" +services: + web: + build: . + restart: on-failure + depends_on: + - db + links: + - db + networks: + - yprov_net + ports: + - "3000:3000" + environment: + USER: neo4j + PASSWORD: password + ADDRESS: db:7687 + volumes: + - yprov_data:/app/conf + + db: + image: "neo4j:enterprise" + ports: + - "7474:7474" + - "7687:7687" + environment: + NEO4J_AUTH: neo4j/password + NEO4J_ACCEPT_LICENSE_AGREEMENT: eval + NEO4J_PLUGINS: '["graph-data-science"]' + volumes: + - neo4j_data:/data + - neo4j_logs:/logs + networks: + - yprov_net + healthcheck: + test: ["CMD", "curl", "-f", "http://db:7474"] + interval: 30s + timeout: 10s + retries: 5 + +volumes: + neo4j_data: + neo4j_logs: + yprov_data: + +networks: + yprov_net: \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 16d3b77..dcaf088 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,7 @@ -pytest -requests \ No newline at end of file +Flask==2.3.1 +prov==2.0.0 +prov2neo[dev] +py2neo==2021.2.4 +PyJWT==2.8.0 +bcrypt==4.1.2 +passlib==1.7.4 \ No newline at end of file