diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..870f97c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM python:3.11 + +WORKDIR /var/www/cleverson.online + +COPY requirements.txt . + +RUN pip install -r requirements.txt + +COPY . . + +CMD ['gunicorn','-b', '0.0.0.0:5000', 'wsgi:app'] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..c1185a0 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,28 @@ +version: "3.5" + +services: + nginx: + image: nginx:latest + volumes: + - ./nginx.conf:/etc/nginx/nginx.conf:ro + environment: + - FLASK_SERVER_ADDR=app:5000 + depends_on: + - app + ports: + - "80:80" + + app: + build: + context: . + ports: + - '5000:5000' + volumes: + - ${HOME}/.database:/root/.database + command: gunicorn -w 2 -b 0.0.0.0:5000 wsgi:app + + +networks: + default: + driver: bridge + name: cleverson.online diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..2525be1 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,19 @@ +events {} + +http { + access_log on; + sendfile on; + + 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; + } + } +} diff --git a/wsgi.py b/wsgi.py new file mode 100644 index 0000000..fe05d46 --- /dev/null +++ b/wsgi.py @@ -0,0 +1,6 @@ +from app import create_app + +app = create_app() + +if __name__ == "__main__": + app.run()