From affc92b094249c62fd239c0d00ff614ac689799e Mon Sep 17 00:00:00 2001 From: benninghoven Date: Sat, 13 Apr 2024 22:30:22 -0700 Subject: [PATCH] added docker compose file --- backend/db/init.sql | 10 ++++++++++ backend/db/my.cnf | 0 backend/docker-compose.yml | 21 +++++++++++++++++++++ backend/main.py | 13 ------------- backend/requirements.txt | 7 ------- 5 files changed, 31 insertions(+), 20 deletions(-) create mode 100644 backend/db/init.sql create mode 100644 backend/db/my.cnf create mode 100644 backend/docker-compose.yml delete mode 100644 backend/main.py delete mode 100644 backend/requirements.txt diff --git a/backend/db/init.sql b/backend/db/init.sql new file mode 100644 index 0000000..31f2922 --- /dev/null +++ b/backend/db/init.sql @@ -0,0 +1,10 @@ +CREATE DATABASE IF NOT EXISTS image_database; + +USE image_database; + +CREATE TABLE IF NOT EXISTS images ( + id INT AUTO_INCREMENT PRIMARY KEY, + filename VARCHAR(255) NOT NULL, + filepath VARCHAR(255) NOT NULL, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); diff --git a/backend/db/my.cnf b/backend/db/my.cnf new file mode 100644 index 0000000..e69de29 diff --git a/backend/docker-compose.yml b/backend/docker-compose.yml new file mode 100644 index 0000000..3552b69 --- /dev/null +++ b/backend/docker-compose.yml @@ -0,0 +1,21 @@ +version: '3.8' + +services: + db: + image: mysql:8 + restart: always + environment: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: mydb + MYSQL_USER: myuser + MYSQL_PASSWORD: password + ports: + - "3306:3306" + volumes: + - mysql_data:/var/lib/mysql + - ./db/init.sql:/docker-entrypoint-initdb.d/init.sql + - ./db/my.cnf:/etc/mysql/my.cnf + +volumes: + mysql_data: + diff --git a/backend/main.py b/backend/main.py deleted file mode 100644 index 7ddc5c4..0000000 --- a/backend/main.py +++ /dev/null @@ -1,13 +0,0 @@ -from flask import Flask, request, jsonify - -app = Flask(__name__) - - -@app.route('/api', methods=['POST']) -def api(): - data = request.get_json() - return jsonify(data) - - -if __name__ == '__main__': - app.run(debug=True) diff --git a/backend/requirements.txt b/backend/requirements.txt deleted file mode 100644 index f0c0dd7..0000000 --- a/backend/requirements.txt +++ /dev/null @@ -1,7 +0,0 @@ -blinker==1.7.0 -click==8.1.7 -Flask==3.0.3 -itsdangerous==2.1.2 -Jinja2==3.1.3 -MarkupSafe==2.1.5 -Werkzeug==3.0.2