пробный конфиг для докер компоус
This commit is contained in:
parent
657ea0ccf6
commit
f5e4f0b0c5
15
Dockerfile
Normal file
15
Dockerfile
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
FROM python:3.10-slim
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
libpq-dev \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY requirements.txt .
|
||||||
|
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
CMD ["python", "main.py"]
|
||||||
29
docker-compose.yml
Normal file
29
docker-compose.yml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
nginx:
|
||||||
|
image: nginx:alpine
|
||||||
|
volumes:
|
||||||
|
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
||||||
|
ports:
|
||||||
|
- "80:80"
|
||||||
|
depends_on:
|
||||||
|
- app_moona
|
||||||
|
- app_other
|
||||||
|
|
||||||
|
app_moona:
|
||||||
|
build:
|
||||||
|
context: ./moona
|
||||||
|
volumes:
|
||||||
|
- ./moona/db:/app/db
|
||||||
|
- ./moona/static:/app/static
|
||||||
|
environment:
|
||||||
|
- SECRET_KEY=your-secret-key
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
certbot:
|
||||||
|
image: certbot/certbot
|
||||||
|
volumes:
|
||||||
|
- ./letsencrypt:/etc/letsencrypt
|
||||||
|
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
||||||
|
command: certonly --webroot --webroot-path=/var/www/certbot --email andrei@duvakin.com --agree-tos --no-eff-email -d moona.numerum.site
|
||||||
2
main.py
2
main.py
@ -28,7 +28,7 @@ from forms.register import RegisterForm, Confirmation
|
|||||||
from post import mail
|
from post import mail
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
app.config['SECRET_KEY'] = open('protect.moona', 'r', encoding='utf-8').read().split()[2]
|
app.config['SECRET_KEY'] = os.getenv('SECRET_KEY', 'default_key_for_dev')
|
||||||
logging.basicConfig(filename='main.log')
|
logging.basicConfig(filename='main.log')
|
||||||
login_manager = LoginManager()
|
login_manager = LoginManager()
|
||||||
login_manager.init_app(app)
|
login_manager.init_app(app)
|
||||||
|
|||||||
11
nginx.conf
Normal file
11
nginx.conf
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name moona.numerum.site;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://app_moona: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;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user