From 104b7795eef69c12dc7bc609b2e77183a3cbbcee Mon Sep 17 00:00:00 2001 From: Xander Date: Mon, 16 Dec 2024 18:09:35 +0200 Subject: [PATCH] first commit --- .gitignore | 30 ++++++++++++++++++++++++++++++ Dockerfile | 18 ++++++++++++++++++ app.py | 10 ++++++++++ docker-compose.yml | 11 +++++++++++ requirements.txt | 1 + 5 files changed, 70 insertions(+) create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 app.py create mode 100644 docker-compose.yml create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b503462 --- /dev/null +++ b/.gitignore @@ -0,0 +1,30 @@ +# Byte-compiled files +__pycache__/ +*.py[cod] + +# Environment variables +.env + +# Virtual environments +venv/ +*.venv + +# Docker +*.log +*.pid +*.bak +*.swp +.dockerignore +docker-compose.override.yml + +# Python package files +*.egg +*.egg-info/ +dist/ +build/ +*.pyc + +# IDE/Editor files +.vscode/ +.idea/ +*.iml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..10a92e6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +# Use the official Python image with a specific version +FROM python:3.10-slim + +# Set the working directory +WORKDIR /app + +# Copy requirements and install them (if there were any) +COPY requirements.txt /app/ +RUN pip install -r requirements.txt + +# Copy the rest of the application code +COPY . /app + +# Expose the port the app runs on +EXPOSE 5000 + +# Command to run the application +CMD ["python", "app.py"] \ No newline at end of file diff --git a/app.py b/app.py new file mode 100644 index 0000000..7a084da --- /dev/null +++ b/app.py @@ -0,0 +1,10 @@ +from flask import Flask + +app = Flask(__name__) + +@app.route('/') +def hello_world(): + return 'Hello, World!' + +if __name__ == '__main__': + app.run(host='0.0.0.0', port=5000) diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..b73ece6 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,11 @@ +version: '3.8' + +services: + flask-app: + build: + context: . + ports: + - "5000:5000" + volumes: + - .:/app + command: python app.py \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..8c33811 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +flask==2.3.3 \ No newline at end of file