1
0
mirror of https://github.com/ijaric/voice_assistant.git synced 2025-05-24 14:33:26 +00:00

Basic Docker files

This commit is contained in:
Artem Litvinov 2023-09-16 10:36:39 +01:00
parent 848e7f059f
commit 4ee32cfb3f
7 changed files with 112 additions and 2 deletions

View File

@ -0,0 +1,2 @@
.venv
.env

View File

@ -0,0 +1,11 @@
LOG_LEVEL_HANDLERS=INFO
LOG_LEVEL_LOGGERS=INFO
LOG_LEVEL_ROOT=INFO
API_PORT=8000
NGINX_PORT=80
PROJET_NAME="FastAPI Template"
PROJECT_DESCRIPTION="FastAPI Template Project using DDD"
PROJECT_VERSION=0.0.1

View File

@ -0,0 +1,18 @@
FROM python:3.11
RUN apt-get update
WORKDIR /opt/app
ENV PYTHONPATH '/opt/app'
COPY pyproject.toml ./
COPY poetry.lock ./
RUN apt-get update \
&& pip install poetry \
&& poetry config virtualenvs.create false \
&& poetry install --no-dev
COPY backend .
# CMD ["python", "-m", "bin"]

View File

@ -0,0 +1,30 @@
version: '3'
services:
api:
build:
context: .
ports:
- "${API_PORT}:${API_PORT}"
expose:
- ${API_PORT}
env_file:
- .env
nginx:
image: nginx:1.25.1
restart: always
env_file:
- .env
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/templates:/etc/nginx/templates
ports:
- "${NGINX_PORT}:${NGINX_PORT}"
depends_on:
- api
networks:
default:
driver: bridge

View File

@ -0,0 +1,38 @@
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
server_tokens off;
sendfile on;
tcp_nodelay on;
tcp_nopush on;
client_max_body_size 200m;
gzip on;
gzip_comp_level 3;
gzip_min_length 1000;
gzip_types
text/plain
text/css
application/json
application/x-javascript
text/xml
text/javascript;
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/api.conf;
include conf.d/rabbitmq.conf;
}

View File

@ -0,0 +1,11 @@
server {
listen ${NGINX_PORT} default_server;
listen [::]:${NGINX_PORT} default_server;
server_name _;
location /api {
proxy_pass http://api:${API_PORT}/api;
proxy_set_header X-Request-Id $request_id;
}
}

View File

@ -14,8 +14,8 @@ profile = "black"
[tool.poetry] [tool.poetry]
authors = ["name <name@email.com>"] authors = ["name <name@email.com>"]
description = "FastAPI Template Project using DDD" description = "FastAPI Template Project using DDD"
name = "FastAPI Exmaple" name = "FastAPI Template"
version = "0.1.0" version = "0.0.1"
[tool.poetry.dependencies] [tool.poetry.dependencies]
black = "^23.9.1" black = "^23.9.1"