File tree 3 files changed +10
-3
lines changed
3 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 22
22
23
23
ENV UVICORN_PORT 8000
24
24
ENV UVICORN_HOST 0.0.0.0
25
+ ENV CONTEXT_ROOT ""
25
26
USER root
26
27
RUN apt-get update && \
27
28
apt-get install -y gcc && \
@@ -37,6 +38,6 @@ USER 1001:100
37
38
WORKDIR /app
38
39
EXPOSE $UVICORN_PORT
39
40
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
40
- CMD curl -I --silent --fail "http://localhost:$UVICORN_PORT/" || exit 1
41
+ CMD curl -I --silent --fail "http://localhost:$UVICORN_PORT/$CONTEXT_ROOT " || exit 1
41
42
ENTRYPOINT ["/bin/start_uvicorn" ]
42
43
CMD ["asgi:app" ]
Original file line number Diff line number Diff line change @@ -14,8 +14,9 @@ environment flags to control how the ASGI application is started.
14
14
15
15
Flag | Default | Comment
16
16
---------------- | ----------------- | ---------------------------------------------------
17
- UVICORN_PORT | 8000 | Application port.
17
+ UVICORN_PORT | 8000 | Application port.
18
18
UVICORN_HOST | 0.0.0.0 | Application bind address.
19
+ CONTEXT_ROOT | None | Context root where application is served.
19
20
20
21
### Creating a Dockerfile
21
22
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
- uvicorn --port $UVICORN_PORT --host $UVICORN_HOST --log-level ${LOG_LEVEL:- info} $*
2
+ if [ $CONTEXT_ROOT ]; then
3
+ ROOT=" --root-path $CONTEXT_ROOT "
4
+ else
5
+ ROOT=" "
6
+ fi
7
+ uvicorn --port $UVICORN_PORT --host $UVICORN_HOST --log-level ${LOG_LEVEL:- info} $ROOT_PATH $*
You can’t perform that action at this time.
0 commit comments