mirror of
				https://github.com/ijaric/voice_assistant.git
				synced 2025-10-30 13:03:25 +00:00 
			
		
		
		
	Merge pull request #1 from ijaric/feature/docker
Docker Files: FastAPI Template [Тест]
This commit is contained in:
		
						commit
						cfb1ed5866
					
				
							
								
								
									
										2
									
								
								src/fastapi_example/.dockerignore
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								src/fastapi_example/.dockerignore
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,2 @@ | ||||||
|  | .venv | ||||||
|  | .env | ||||||
							
								
								
									
										11
									
								
								src/fastapi_example/.env.example
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								src/fastapi_example/.env.example
									
									
									
									
									
										Normal 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 | ||||||
|  | 
 | ||||||
							
								
								
									
										18
									
								
								src/fastapi_example/Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								src/fastapi_example/Dockerfile
									
									
									
									
									
										Normal 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"] | ||||||
							
								
								
									
										29
									
								
								src/fastapi_example/docker-compose.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								src/fastapi_example/docker-compose.yaml
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,29 @@ | ||||||
|  | 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 | ||||||
							
								
								
									
										38
									
								
								src/fastapi_example/nginx/nginx.conf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								src/fastapi_example/nginx/nginx.conf
									
									
									
									
									
										Normal 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; | ||||||
|  | } | ||||||
							
								
								
									
										11
									
								
								src/fastapi_example/nginx/templates/api.conf.template
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								src/fastapi_example/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:${API_PORT}/api; | ||||||
|  |         proxy_set_header X-Request-Id $request_id; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  | @ -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" | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user