mirror of https://github.com/hunshcn/gh-proxy
parent
1ba7d93ea4
commit
c383b024c0
@ -0,0 +1,27 @@
|
|||||||
|
FROM tiangolo/uwsgi-nginx:python3.7
|
||||||
|
|
||||||
|
LABEL maintainer="Sebastian Ramirez <tiangolo@gmail.com>"
|
||||||
|
|
||||||
|
RUN pip install flask requests
|
||||||
|
|
||||||
|
COPY ./app /app
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Make /app/* available to be imported by Python globally to better support several use cases like Alembic migrations.
|
||||||
|
ENV PYTHONPATH=/app
|
||||||
|
|
||||||
|
# Move the base entrypoint to reuse it
|
||||||
|
RUN mv /entrypoint.sh /uwsgi-nginx-entrypoint.sh
|
||||||
|
# Copy the entrypoint that will generate Nginx additional configs
|
||||||
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
RUN chmod +x /entrypoint.sh
|
||||||
|
|
||||||
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|
||||||
|
# Run the start script provided by the parent image tiangolo/uwsgi-nginx.
|
||||||
|
# It will check for an /app/prestart.sh script (e.g. for migrations)
|
||||||
|
# And then will start Supervisor, which in turn will start Nginx and uWSGI
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
|
CMD ["/start.sh"]
|
@ -0,0 +1,3 @@
|
|||||||
|
[uwsgi]
|
||||||
|
module = main
|
||||||
|
callable = app
|
@ -0,0 +1,26 @@
|
|||||||
|
#! /usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
/uwsgi-nginx-entrypoint.sh
|
||||||
|
|
||||||
|
# Get the listen port for Nginx, default to 80
|
||||||
|
USE_LISTEN_PORT=${LISTEN_PORT:-80}
|
||||||
|
|
||||||
|
if [ -f /app/nginx.conf ]; then
|
||||||
|
cp /app/nginx.conf /etc/nginx/nginx.conf
|
||||||
|
else
|
||||||
|
content_server='server {\n'
|
||||||
|
content_server=$content_server" listen ${USE_LISTEN_PORT};\n"
|
||||||
|
content_server=$content_server' location / {\n'
|
||||||
|
content_server=$content_server' try_files $uri @app;\n'
|
||||||
|
content_server=$content_server' }\n'
|
||||||
|
content_server=$content_server' location @app {\n'
|
||||||
|
content_server=$content_server' include uwsgi_params;\n'
|
||||||
|
content_server=$content_server' uwsgi_pass unix:///tmp/uwsgi.sock;\n'
|
||||||
|
content_server=$content_server' }\n'
|
||||||
|
content_server=$content_server'}\n'
|
||||||
|
# Save generated server /etc/nginx/conf.d/nginx.conf
|
||||||
|
printf "$content_server" > /etc/nginx/conf.d/nginx.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$@"
|
Loading…
Reference in new issue