mirror of
https://github.com/ijaric/voice_assistant.git
synced 2025-05-24 14:33:26 +00:00
ci: nginx templates
This commit is contained in:
parent
dc4a15a254
commit
0923015894
|
@ -4,6 +4,7 @@ DB_USER=user
|
|||
DB_PASSWORD=Qwe123
|
||||
DB_NAME=api_db
|
||||
|
||||
NGINX_PORT=80
|
||||
SERVER_HOST=0.0.0.0
|
||||
SERVER_PORT=8000
|
||||
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
FROM python:3.11
|
||||
|
||||
RUN mkdir --parents /opt/app
|
||||
COPY pyproject.toml /opt/app/pyproject.toml
|
||||
COPY poetry.lock /opt/app/poetry.lock
|
||||
COPY poetry.toml /opt/app/poetry.toml
|
||||
|
||||
WORKDIR /opt/app
|
||||
|
||||
ENV PYTHONPATH '/opt/app'
|
||||
|
||||
COPY pyproject.toml ./
|
||||
RUN pip install poetry \
|
||||
&& poetry install --no-dev
|
||||
|
||||
COPY bin bin
|
||||
COPY lib lib
|
||||
COPY entrypoint.sh .
|
||||
COPY bin /opt/app/bin
|
||||
COPY lib /opt/app/lib
|
||||
COPY entrypoint.sh /opt/app/entrypoint.sh
|
||||
|
||||
RUN chmod +x /opt/app/entrypoint.sh
|
||||
|
|
|
@ -3,6 +3,7 @@ version: "3"
|
|||
services:
|
||||
db:
|
||||
image: postgres:15.2
|
||||
restart: always
|
||||
environment:
|
||||
POSTGRES_USER: ${DB_USER}
|
||||
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
||||
|
@ -13,7 +14,6 @@ services:
|
|||
- "${DB_PORT}:${DB_PORT}"
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data/
|
||||
restart: always
|
||||
networks:
|
||||
- backend_network
|
||||
|
||||
|
@ -24,24 +24,27 @@ services:
|
|||
image: fastapi_app
|
||||
restart: always
|
||||
entrypoint: ["/opt/app/entrypoint.sh"]
|
||||
env_file:
|
||||
- .env
|
||||
ports:
|
||||
- "${SERVER_PORT}:${SERVER_PORT}"
|
||||
depends_on:
|
||||
- db
|
||||
env_file:
|
||||
- .env
|
||||
networks:
|
||||
- backend_network
|
||||
- api_network
|
||||
|
||||
nginx:
|
||||
image: nginx:1.23.4
|
||||
image: nginx:1.25.1
|
||||
env_file:
|
||||
- .env
|
||||
ports:
|
||||
- "${NGINX_PORT}:${NGINX_PORT}"
|
||||
volumes:
|
||||
- ./nginx:/etc/nginx/:ro
|
||||
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
- ./nginx/templates:/etc/nginx/templates
|
||||
depends_on:
|
||||
- api
|
||||
ports:
|
||||
- "80:80"
|
||||
networks:
|
||||
- api_network
|
||||
|
||||
|
|
|
@ -3,17 +3,17 @@ version: "3"
|
|||
services:
|
||||
db:
|
||||
image: postgres:15.2
|
||||
restart: always
|
||||
environment:
|
||||
POSTGRES_USER: ${DB_USER}
|
||||
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
||||
POSTGRES_DB: ${DB_NAME}
|
||||
env_file:
|
||||
- .env
|
||||
ports:
|
||||
- "127.0.0.1:${DB_PORT}:${DB_PORT}"
|
||||
expose:
|
||||
- "${DB_PORT}"
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data/
|
||||
restart: always
|
||||
networks:
|
||||
- backend_network
|
||||
|
||||
|
@ -24,22 +24,27 @@ services:
|
|||
image: fastapi_app
|
||||
restart: always
|
||||
entrypoint: ["/opt/app/entrypoint.sh"]
|
||||
depends_on:
|
||||
- db
|
||||
env_file:
|
||||
- .env
|
||||
expose:
|
||||
- "${SERVER_PORT}"
|
||||
depends_on:
|
||||
- db
|
||||
networks:
|
||||
- backend_network
|
||||
- api_network
|
||||
|
||||
nginx:
|
||||
image: nginx:1.23.4
|
||||
image: nginx:1.25.1
|
||||
env_file:
|
||||
- .env
|
||||
ports:
|
||||
- "${NGINX_PORT}:${NGINX_PORT}"
|
||||
volumes:
|
||||
- ./nginx:/etc/nginx/:ro
|
||||
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
- ./nginx/templates:/etc/nginx/templates
|
||||
depends_on:
|
||||
- api
|
||||
ports:
|
||||
- "80:80"
|
||||
networks:
|
||||
- api_network
|
||||
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
server_name _;
|
||||
|
||||
location /api {
|
||||
proxy_pass http://api:8000/api;
|
||||
}
|
||||
|
||||
}
|
|
@ -31,7 +31,5 @@ http {
|
|||
proxy_redirect off;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
|
||||
include conf.d/site.conf;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
|
11
src/fastapi_app/nginx/templates/api.conf.template
Normal file
11
src/fastapi_app/nginx/templates/api.conf.template
Normal file
|
@ -0,0 +1,11 @@
|
|||
server {
|
||||
listen ${NGINX_PORT} default_server;
|
||||
listen [::]:${NGINX_PORT} default_server;
|
||||
server_name _;
|
||||
|
||||
location /api {
|
||||
proxy_pass http://api:${SERVER_PORT}/api;
|
||||
proxy_set_header X-Request-Id $request_id;
|
||||
}
|
||||
|
||||
}
|
6
src/fastapi_app/poetry.lock
generated
6
src/fastapi_app/poetry.lock
generated
|
@ -937,13 +937,13 @@ pycryptodome = ["pyasn1", "pycryptodome (>=3.3.1,<4.0.0)"]
|
|||
|
||||
[[package]]
|
||||
name = "pyupgrade"
|
||||
version = "3.11.1"
|
||||
version = "3.12.0"
|
||||
description = "A tool to automatically upgrade syntax for newer versions."
|
||||
optional = false
|
||||
python-versions = ">=3.8.1"
|
||||
files = [
|
||||
{file = "pyupgrade-3.11.1-py2.py3-none-any.whl", hash = "sha256:6e9dd362394b3068123e06ca268de5845d41e2bb29f387b38323cc1009fb3100"},
|
||||
{file = "pyupgrade-3.11.1.tar.gz", hash = "sha256:3e6c7689d2f3ae418c6a60ee981477fe9130eccaed3e33dac6c21274cf7d45f4"},
|
||||
{file = "pyupgrade-3.12.0-py2.py3-none-any.whl", hash = "sha256:c6f9c129560b9538e75b93fb0aee20508faae454714e8373d462e408985bd96a"},
|
||||
{file = "pyupgrade-3.12.0.tar.gz", hash = "sha256:defc292ffaf402942b8fccaa97491964063e343fc1993230e44890b971dc1234"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
|
|
Loading…
Reference in New Issue
Block a user