diff --git a/app.py b/app.py index 06c20348472084043422be273ba4443a17c3eb4b..dd7997f2543876d6a76de9c32adfec90e2cbf9c6 100644 --- a/app.py +++ b/app.py @@ -11,7 +11,7 @@ app.config['MYSQL_USER'] = os.getenv('MYSQL_USER') app.config['MYSQL_PASSWORD'] = os.getenv('MYSQL_PASSWORD') app.config['MYSQL_DB'] = os.getenv('MYSQL_DB') - +print (os.getenv('MYSQL_HOST')); # Initialize MySQL mysql = MySQL(app) @@ -69,10 +69,10 @@ def delete_user(id): cursor.close() return jsonify({'message': 'User deleted successfully!'}) + @app.route('/') def hello_world(): - return f'Hello, from flask app!' + return f'I am Hayfa rajhi ' if __name__ == '__main__': app.run(debug=True, host=os.environ.get('FLASK_RUN_HOST', '0.0.0.0'), port=int(os.environ.get('FLASK_RUN_PORT', 5000))) - diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..e2e24316ce00b3494b2c8bfd21d0aac43cdd43f4 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,28 @@ +version: '3.9' +services: + dev: + build: + context: . + dockerfile: dockerfile + ports: + - 5000:5000 + environment: + - MYSQL_HOST=db + - MYSQL_USER=root + - MYSQL_PASSWORD=haifa + - MYSQL_DB=workshop + volumes: + - .:/app + depends_on: + - db + db: + image: mysql:5.7 + environment: + - MYSQL_ROOT_PASSWORD=haifa + volumes: + - db_data:/var/lib/mysql + - ./scripts:/docker-entrypoint-initdb.d + ports: + - "3306:3306" +volumes: + db_data: \ No newline at end of file diff --git a/dockerfile b/dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..5f2020b84a606aa2114987818d1b366cdc412173 --- /dev/null +++ b/dockerfile @@ -0,0 +1,10 @@ +FROM python:latest + +WORKDIR /app + +COPY requirements.txt requirements.txt +RUN pip3 install -r requirements.txt + +COPY . . + +CMD [ "python3", "app.py","--host=0.0.0.0"] \ No newline at end of file diff --git a/solution.tar.gz b/solution.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..e308f2d60f597e1a2af0d412b5b6fdacc5645283 Binary files /dev/null and b/solution.tar.gz differ