This commit is contained in:
norohind 2023-11-28 21:52:00 +03:00
commit 23b4185a4b
4 changed files with 33 additions and 0 deletions

5
Caddyfile Normal file
View File

@ -0,0 +1,5 @@
:80 {
reverse_proxy uwsgi:3000 {
transport uwsgi
}
}

22
docker-compose.yaml Normal file
View File

@ -0,0 +1,22 @@
services:
caddy:
build:
dockerfile_inline: |
FROM docker.io/caddy:2.7.5-builder-alpine AS builder
RUN xcaddy build --with github.com/wxh06/caddy-uwsgi-transport
FROM docker.io/caddy:2.7.5-alpine
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
COPY Caddyfile /etc/caddy/Caddyfile
ports:
- "8888:80"
uwsgi:
build:
dockerfile_inline: |
FROM docker.io/python:3.11-slim
RUN apt update && apt install -y --no-install-recommends gcc libc6-dev && pip install uwsgi
COPY hello.py /hello.py
COPY uwsgi.ini /uwsgi.ini
# CMD ["/usr/local/bin/uwsgi", "--socket", ":3000", "--wsgi-file", "/hello.py"] # That way it works
CMD ["/usr/local/bin/uwsgi", "-c", "/uwsgi.ini"] # That way it doesn't works

3
hello.py Normal file
View File

@ -0,0 +1,3 @@
def application(env, start_response):
start_response('200 OK', [('Content-Type','text/html')])
return [b"Hello World"]

3
uwsgi.ini Normal file
View File

@ -0,0 +1,3 @@
[uwsgi]
socket = :3000
wsgi-file = /hello.py