first commit
This commit is contained in:
commit
26f91a08fe
13
app/Dockerfile
Normal file
13
app/Dockerfile
Normal file
@ -0,0 +1,13 @@
|
||||
# Используем образ Python
|
||||
FROM python:3.9-slim
|
||||
|
||||
# Устанавливаем зависимости
|
||||
WORKDIR /app
|
||||
COPY requirements.txt requirements.txt
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
# Копируем исходный код приложения
|
||||
COPY . .
|
||||
|
||||
# Запускаем приложение
|
||||
CMD ["python", "app.py"]
|
||||
10
app/app.py
Normal file
10
app/app.py
Normal file
@ -0,0 +1,10 @@
|
||||
from flask import Flask
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route('/')
|
||||
def hello_world():
|
||||
return 'Hello, World!'
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(host='0.0.0.0', port=5000)
|
||||
1
app/requirements.txt
Normal file
1
app/requirements.txt
Normal file
@ -0,0 +1 @@
|
||||
flask
|
||||
14
docker-compose.yml
Normal file
14
docker-compose.yml
Normal file
@ -0,0 +1,14 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
web:
|
||||
build: ./web
|
||||
ports:
|
||||
- "8080:80"
|
||||
depends_on:
|
||||
- app
|
||||
|
||||
app:
|
||||
build: ./app
|
||||
ports:
|
||||
- "5000:5000"
|
||||
5
web/Dockerfile
Normal file
5
web/Dockerfile
Normal file
@ -0,0 +1,5 @@
|
||||
# Используем образ Nginx
|
||||
FROM nginx:alpine
|
||||
|
||||
# Копируем конфигурационный файл Nginx
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
14
web/nginx.conf
Normal file
14
web/nginx.conf
Normal file
@ -0,0 +1,14 @@
|
||||
events { }
|
||||
|
||||
http {
|
||||
server {
|
||||
listen 80;
|
||||
location / {
|
||||
proxy_pass http://app:5000;
|
||||
proxy_set_header Host $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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user