feat: better deploy

This commit is contained in:
Pavel Korytov 2021-12-11 19:08:46 +03:00
parent 8e7860a10b
commit 0edb77b03d
5 changed files with 23 additions and 1 deletions

8
Dockerfile Normal file
View file

@ -0,0 +1,8 @@
FROM nginx:1.21.4
RUN apt-get update && apt-get install -y python3 python3-pip git
RUN pip install flask python-dotenv flask_httpauth gunicorn
COPY . /usr/share/nginx/html
RUN mv /usr/share/nginx/html/deploy /
RUN (cd /usr/share/nginx/html && git remote set-url origin https://github.com/SqrtMinusOne/sqrtminusone.github.io.git)
RUN rm /usr/share/nginx/html/index.html
CMD bash /deploy/entrypoint.sh

5
deploy/entrypoint.sh Normal file
View file

@ -0,0 +1,5 @@
#!/usr/bin/env bash
CWD=/usr/share/nginx/html
(cd $CWD && git fetch origin && git checkout origin/gh-pages)
(cd /deploy && gunicorn -w 1 "deployer:create_app()") &
nginx -g 'daemon off;'

9
docker-compose.yml Normal file
View file

@ -0,0 +1,9 @@
version: "3.5"
services:
sqrtminusone.xyz:
restart: unless-stopped
container_name: "sqrtminusone.xyz"
build: .
ports:
- 8080:80
- 8081:8000

@ -1 +1 @@
Subproject commit ba92551ade9d231b2c13663f815b82804bcc60d3
Subproject commit 78ecd7e1bba152ac73ea6206906384aea384c58a