From d710450697eb7d83845c717ca296e9713607f38e Mon Sep 17 00:00:00 2001 From: Simon Cloutier Date: Fri, 28 Mar 2025 08:23:48 -0400 Subject: [PATCH] Foundation --- app/Dockerfile | 12 ++++++++++++ app/requirements.txt | 2 ++ app/templates/add_user.html | 0 app/templates/edit_user.html | 0 app/templates/user_list.html | 0 docker-compose.yml | 31 +++++++++++++++++++++++++++++++ nginx/Dockerfile | 3 +++ nginx/nginx.conf | 16 ++++++++++++++++ 8 files changed, 64 insertions(+) create mode 100644 app/Dockerfile create mode 100644 app/requirements.txt create mode 100644 app/templates/add_user.html create mode 100644 app/templates/edit_user.html create mode 100644 app/templates/user_list.html create mode 100644 docker-compose.yml create mode 100644 nginx/Dockerfile create mode 100644 nginx/nginx.conf diff --git a/app/Dockerfile b/app/Dockerfile new file mode 100644 index 0000000..4e51849 --- /dev/null +++ b/app/Dockerfile @@ -0,0 +1,12 @@ +FROM python:3.9-slim + +WORKDIR /app + +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +COPY . . + +EXPOSE 5000 + +CMD ["python", "app.py"] \ No newline at end of file diff --git a/app/requirements.txt b/app/requirements.txt new file mode 100644 index 0000000..a754bdf --- /dev/null +++ b/app/requirements.txt @@ -0,0 +1,2 @@ +Flask +mysql-connector-python \ No newline at end of file diff --git a/app/templates/add_user.html b/app/templates/add_user.html new file mode 100644 index 0000000..e69de29 diff --git a/app/templates/edit_user.html b/app/templates/edit_user.html new file mode 100644 index 0000000..e69de29 diff --git a/app/templates/user_list.html b/app/templates/user_list.html new file mode 100644 index 0000000..e69de29 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..91a8832 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,31 @@ +version: '3.8' + +services: + app: + build: + context: ./app + dockerfile: Dockerfile + volumes: + - ./app:/app + environment: + - FLASK_APP=app.py + - FLASK_ENV=development + depends_on: + - db + nginx: + build: + context: ./nginx + dockerfile: Dockerfile + ports: + - "80:80" + depends_on: + - app + db: + image: mariadb:10.6 + environment: + MYSQL_ROOT_PASSWORD: your_root_password + MYSQL_DATABASE: radius + MYSQL_USER: radiususer + MYSQL_PASSWORD: radiuspassword + volumes: + - ./db-data:/var/lib/mysql # persistant data. \ No newline at end of file diff --git a/nginx/Dockerfile b/nginx/Dockerfile new file mode 100644 index 0000000..9ded20d --- /dev/null +++ b/nginx/Dockerfile @@ -0,0 +1,3 @@ +FROM nginx:alpine + +COPY nginx.conf /etc/nginx/nginx.conf \ No newline at end of file diff --git a/nginx/nginx.conf b/nginx/nginx.conf new file mode 100644 index 0000000..552c98f --- /dev/null +++ b/nginx/nginx.conf @@ -0,0 +1,16 @@ +events {} + +http { + server { + listen 80; + server_name localhost; + + location / { + proxy_pass http://app:5000; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + } +} \ No newline at end of file