Skip to content
Snippets Groups Projects
Commit 57113aab authored by Iheb Boussida's avatar Iheb Boussida
Browse files

first commit

parent bac35801
Branches build-dev-env
No related tags found
No related merge requests found
...@@ -11,7 +11,7 @@ app.config['MYSQL_USER'] = os.getenv('MYSQL_USER') ...@@ -11,7 +11,7 @@ app.config['MYSQL_USER'] = os.getenv('MYSQL_USER')
app.config['MYSQL_PASSWORD'] = os.getenv('MYSQL_PASSWORD') app.config['MYSQL_PASSWORD'] = os.getenv('MYSQL_PASSWORD')
app.config['MYSQL_DB'] = os.getenv('MYSQL_DB') app.config['MYSQL_DB'] = os.getenv('MYSQL_DB')
print (os.getenv('MYSQL_HOST'));
# Initialize MySQL # Initialize MySQL
mysql = MySQL(app) mysql = MySQL(app)
...@@ -69,10 +69,10 @@ def delete_user(id): ...@@ -69,10 +69,10 @@ def delete_user(id):
cursor.close() cursor.close()
return jsonify({'message': 'User deleted successfully!'}) return jsonify({'message': 'User deleted successfully!'})
@app.route('/') @app.route('/')
def hello_world(): def hello_world():
return f'Hello, from flask app!' return f'I am Hayfa rajhi '
if __name__ == '__main__': 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))) app.run(debug=True, host=os.environ.get('FLASK_RUN_HOST', '0.0.0.0'), port=int(os.environ.get('FLASK_RUN_PORT', 5000)))
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
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
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment