diff --git a/.dockerignore b/.dockerignore index fd27f2f..f68b57c 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,3 @@ dev_env -execu.bat \ No newline at end of file +execu.bat +NginxServer diff --git a/.gitignore b/.gitignore index aa8afed..dbdbcdc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ dev_env/lib/python3.12/site-packages/PIL/__pycache__/XVThumbImagePlugin.cpython-312.pyc dev_env dev_home +gestaoRaul/static \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index a45588f..d3eb6e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,4 +7,11 @@ RUN pip install --no-cache-dir -r requirements.txt COPY . . -CMD [ "python", "gestaoRaul/manage.py", "runserver", "0.0.0.0:8000" ] \ No newline at end of file +RUN python gestaoRaul/manage.py collectstatic --noinput + +WORKDIR /app/gestaoRaul + + + +CMD [ "gunicorn", "gestaoRaul.wsgi:application", "--bind", "0.0.0.0:8000" ] + \ No newline at end of file diff --git a/NginxServer/Dockerfile b/NginxServer/Dockerfile new file mode 100644 index 0000000..482e846 --- /dev/null +++ b/NginxServer/Dockerfile @@ -0,0 +1,7 @@ +FROM nginx:latest + +# Remover a configuração padrão +RUN rm /etc/nginx/conf.d/default.conf + +# Copiar sua configuração personalizada +COPY nginx.conf /etc/nginx/conf.d/ \ No newline at end of file diff --git a/NginxServer/nginx.conf b/NginxServer/nginx.conf new file mode 100644 index 0000000..511da2f --- /dev/null +++ b/NginxServer/nginx.conf @@ -0,0 +1,21 @@ + +upstream django_upstream { + server django_app:8000; +} + +server { + listen 80; + server_name rrbec.local.com; + + location /static/ { + alias /app/gestaoRaul/static/; + } + + location / { + proxy_pass http://django_upstream; + proxy_set_header Host $http_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 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..9ddfa3b --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,39 @@ +#version: '3.8' + +services: + django_app: + build: + context: ./ #django_app # Caminho para o Dockerfile da sua aplicação Django + dockerfile: Dockerfile + ports: + - "8000:8000" + volumes: + - static_volume:/app/gestaoRaul/static # Volume para persistir os arquivos estáticos (opcional) + environment: + # Suas variáveis de ambiente do Django + DEBUG: "False" + ALLOWED_HOSTS: "rrbec.local.com, 0.0.0.0, django_app*" # Adicione seu nome de domínio + # depends_on: + # - nginx_server + networks: + - app_network + + nginx_server: + build: + context: ./NginxServer # Caminho para a pasta com o Dockerfile do Nginx e nginx.conf + dockerfile: Dockerfile + volumes: + - static_volume:/app/gestaoRaul/static + ports: + - "80:80" + depends_on: + - django_app + networks: + - app_network + +volumes: + static_volume: # Define o volume para os arquivos estáticos + +networks: + app_network: + driver: bridge \ No newline at end of file diff --git a/gestaoRaul/comandas/__pycache__/views.cpython-312.pyc b/gestaoRaul/comandas/__pycache__/views.cpython-312.pyc index 1e72bd2..e79f5d9 100644 Binary files a/gestaoRaul/comandas/__pycache__/views.cpython-312.pyc and b/gestaoRaul/comandas/__pycache__/views.cpython-312.pyc differ diff --git a/gestaoRaul/gestaoRaul/__pycache__/decorators.cpython-312.pyc b/gestaoRaul/gestaoRaul/__pycache__/decorators.cpython-312.pyc index dba10af..546d996 100644 Binary files a/gestaoRaul/gestaoRaul/__pycache__/decorators.cpython-312.pyc and b/gestaoRaul/gestaoRaul/__pycache__/decorators.cpython-312.pyc differ diff --git a/gestaoRaul/gestaoRaul/__pycache__/settings.cpython-312.pyc b/gestaoRaul/gestaoRaul/__pycache__/settings.cpython-312.pyc index 3ac75c9..8e6edc9 100644 Binary files a/gestaoRaul/gestaoRaul/__pycache__/settings.cpython-312.pyc and b/gestaoRaul/gestaoRaul/__pycache__/settings.cpython-312.pyc differ diff --git a/gestaoRaul/gestaoRaul/settings.py b/gestaoRaul/gestaoRaul/settings.py index 87dac86..29194c6 100644 --- a/gestaoRaul/gestaoRaul/settings.py +++ b/gestaoRaul/gestaoRaul/settings.py @@ -33,6 +33,9 @@ ALLOWED_HOSTS = [ '10.72.150.166', 'localhost', '127.0.0.1', + 'rrbec.local.com', + 'django_app', + '0.0.0.0*' ] diff --git a/gestaoRaul/requirements.txt b/gestaoRaul/requirements.txt deleted file mode 100644 index a7932a4..0000000 --- a/gestaoRaul/requirements.txt +++ /dev/null @@ -1,79 +0,0 @@ -attrs==23.2.0 -Babel==2.10.3 -bcc==0.29.1 -beautifulsoup4==4.12.3 -blinker==1.7.0 -Brlapi==0.8.5 -certifi==2023.11.17 -chardet==5.2.0 -click==8.1.6 -cloud-init==24.4.1 -colorama==0.4.6 -command-not-found==0.3 -configobj==5.0.8 -cryptography==41.0.7 -cssselect==1.2.0 -cupshelpers==1.0 -dbus-python==1.3.2 -defer==1.0.6 -distro==1.9.0 -distro-info==1.7+build1 -html5lib==1.1 -httplib2==0.20.4 -idna==3.6 -Jinja2==3.1.2 -jsonpatch==1.32 -jsonpointer==2.0 -jsonschema==4.10.3 -language-selector==0.1 -launchpadlib==1.11.0 -lazr.restfulclient==0.14.6 -lazr.uri==1.0.6 -louis==3.29.0 -lxml==5.2.1 -markdown-it-py==3.0.0 -MarkupSafe==2.1.5 -mdurl==0.1.2 -netaddr==0.8.0 -netifaces==0.11.0 -numpy==1.26.4 -oauthlib==3.2.2 -olefile==0.46 -pexpect==4.9.0 -pillow==10.2.0 -ptyprocess==0.7.0 -pycairo==1.25.1 -pycups==2.0.1 -Pygments==2.17.2 -PyGObject==3.48.2 -PyJWT==2.7.0 -pyparsing==3.1.1 -PyQt5==5.15.10 -PyQt5-sip==12.13.0 -pyrsistent==0.20.0 -pyserial==3.5 -python-apt==2.7.7+ubuntu4 -python-dateutil==2.8.2 -python-debian==0.1.49+ubuntu2 -pytz==2024.1 -pyxdg==0.28 -PyYAML==6.0.1 -requests==2.31.0 -rich==13.7.1 -scour==0.38.2 -screen-resolution-extra==0.0.0 -setuptools==68.1.2 -six==1.16.0 -soupsieve==2.5 -systemd-python==235 -typing_extensions==4.10.0 -ubuntu-drivers-common==0.0.0 -ubuntu-pro-client==8001 -ufw==0.36.2 -unattended-upgrades==0.1 -urllib3==2.0.7 -wadllib==1.3.6 -webencodings==0.5.1 -wheel==0.42.0 -xdg==5 -xkit==0.0.0 diff --git a/requirements.txt b/requirements.txt index f692a4d..0f6a252 100644 Binary files a/requirements.txt and b/requirements.txt differ