Skip to content

Commit

Permalink
adição de conteiners
Browse files Browse the repository at this point in the history
  • Loading branch information
thisiscleverson committed Mar 27, 2024
1 parent a24d819 commit 751396f
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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']
28 changes: 28 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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
19 changes: 19 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -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;
}
}
}
6 changes: 6 additions & 0 deletions wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from app import create_app

app = create_app()

if __name__ == "__main__":
app.run()

0 comments on commit 751396f

Please sign in to comment.