Added Dockerfile, deploy settings and pipeline config
This commit is contained in:
parent
0ae8a29bfd
commit
7a28024ccd
27
.drone.yml
Normal file
27
.drone.yml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: linux-amd64
|
||||||
|
|
||||||
|
platform:
|
||||||
|
arch: amd64
|
||||||
|
os: linux
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: generate_tag
|
||||||
|
image: golang
|
||||||
|
commands:
|
||||||
|
- echo -n "${DRONE_BRANCH//\//-}-${DRONE_COMMIT_SHA:0:8}, latest" > .tags
|
||||||
|
|
||||||
|
|
||||||
|
- name: publish
|
||||||
|
image: plugins/docker
|
||||||
|
settings:
|
||||||
|
username:
|
||||||
|
from_secret: username
|
||||||
|
password:
|
||||||
|
from_secret: password
|
||||||
|
registry:
|
||||||
|
from_secret: registry
|
||||||
|
repo:
|
||||||
|
from_secret: repo
|
||||||
|
dockerfile: Dockerfile
|
19
Dockerfile
Normal file
19
Dockerfile
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
FROM python:3.10-alpine
|
||||||
|
|
||||||
|
WORKDIR /srv/flask_app
|
||||||
|
RUN apk add nginx build-base libffi-dev curl
|
||||||
|
|
||||||
|
COPY requirements.txt /srv/flask_app/
|
||||||
|
|
||||||
|
RUN pip install -r requirements.txt --src /usr/local/src --no-warn-script-location
|
||||||
|
|
||||||
|
COPY . /srv/flask_app
|
||||||
|
COPY deploy/nginx.conf /etc/nginx
|
||||||
|
RUN chmod +x ./deploy/start.sh
|
||||||
|
RUN chmod +x ./deploy/healthcheck.sh
|
||||||
|
|
||||||
|
HEALTHCHECK --interval=15s --timeout=2s CMD ["./deploy/healthcheck.sh"]
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
|
CMD ["./deploy/start.sh"]
|
2
deploy/healthcheck.sh
Normal file
2
deploy/healthcheck.sh
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
curl -s http://localhost:80/ -o /dev/null || exit 1
|
41
deploy/nginx.conf
Normal file
41
deploy/nginx.conf
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
user root;
|
||||||
|
worker_processes auto;
|
||||||
|
pid /run/nginx.pid;
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 1024;
|
||||||
|
use epoll;
|
||||||
|
multi_accept on;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
access_log /dev/stdout;
|
||||||
|
error_log /dev/stdout;
|
||||||
|
|
||||||
|
sendfile on;
|
||||||
|
tcp_nopush on;
|
||||||
|
tcp_nodelay on;
|
||||||
|
keepalive_timeout 65;
|
||||||
|
types_hash_max_size 2048;
|
||||||
|
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
index index.html index.htm;
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80 default_server;
|
||||||
|
listen [::]:80 default_server;
|
||||||
|
server_name homeserver.flokaiser.com;
|
||||||
|
root /var/www/html;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
include uwsgi_params;
|
||||||
|
uwsgi_pass unix:/tmp/uwsgi.socket;
|
||||||
|
uwsgi_read_timeout 1h;
|
||||||
|
uwsgi_send_timeout 1h;
|
||||||
|
proxy_send_timeout 1h;
|
||||||
|
proxy_read_timeout 1h;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
deploy/start.sh
Normal file
3
deploy/start.sh
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
nginx -g "daemon off;" &
|
||||||
|
uwsgi --ini deploy/uwsgi.ini
|
12
deploy/uwsgi.ini
Normal file
12
deploy/uwsgi.ini
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[uwsgi]
|
||||||
|
module = app:app
|
||||||
|
uid = root
|
||||||
|
gid = root
|
||||||
|
master = true
|
||||||
|
processes = 5
|
||||||
|
|
||||||
|
socket = /tmp/uwsgi.socket
|
||||||
|
chmod-sock = 664
|
||||||
|
vacuum = true
|
||||||
|
|
||||||
|
die-on-term = true
|
0
requirements.txt
Normal file
0
requirements.txt
Normal file
Loading…
Reference in New Issue
Block a user