From d85b5d91534a0ec9f3b91810ef3c7149051ed622 Mon Sep 17 00:00:00 2001 From: Pedro Markun Date: Mon, 2 Oct 2023 02:05:53 -0300 Subject: [PATCH] nginx como proxy por conta do https --- Dockerfile | 2 +- Dockerfile.nginx | 6 ++++++ docker-compose.yml | 12 +++++++++++- nginx/nginx.conf | 20 ++++++++++++++++++++ 4 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 Dockerfile.nginx create mode 100644 nginx/nginx.conf diff --git a/Dockerfile b/Dockerfile index e2dab66..979a157 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ COPY app/requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Instale as dependências necessárias para OpenBLAS e pip (se precisar) RUN apt-get update && apt-get install -y \ - libopenblas-dev \ + libopenblas-dev ffmpeg \ && rm -rf /var/lib/apt/lists/* # Instale o pacote Python com os argumentos CMake diff --git a/Dockerfile.nginx b/Dockerfile.nginx new file mode 100644 index 0000000..047b0d3 --- /dev/null +++ b/Dockerfile.nginx @@ -0,0 +1,6 @@ +# Use uma imagem base do NGINX +FROM nginx:alpine + +# Copie os arquivos de configuração e os certificados +COPY nginx/nginx.conf /etc/nginx/nginx.conf +COPY nginx/certs/ /etc/nginx/certs/ \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index a8fef9b..c9bbcbc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -33,4 +33,14 @@ services: depends_on: - weaviate volumes: - - ./app:/app \ No newline at end of file + - ./app:/app + + nginx: + build: + context: . + dockerfile: Dockerfile.nginx + ports: + - 80:80 + - 443:443 + depends_on: + - flask-app \ No newline at end of file diff --git a/nginx/nginx.conf b/nginx/nginx.conf new file mode 100644 index 0000000..1c6b3fb --- /dev/null +++ b/nginx/nginx.conf @@ -0,0 +1,20 @@ +events { + worker_connections 1024; +} + +http { + server { + listen 80; + return 301 https://$host$request_uri; + } + + server { + listen 443 ssl; + ssl_certificate /etc/nginx/certs/cert.pem; + ssl_certificate_key /etc/nginx/certs/key.pem; + + location / { + proxy_pass http://flask-app:5000; + } + } +} \ No newline at end of file