API port through env variable

This commit is contained in:
Eden Kirin
2023-04-21 12:03:42 +02:00
parent 82259f4522
commit 21a69c7515
2 changed files with 7 additions and 3 deletions

View File

@ -1,9 +1,11 @@
#!/bin/sh #!/bin/sh
echo "Starting FairHopper game server" PORT=${FAIRHOPPER_API_PORT=8010}
echo "Starting FairHopper game server on port ${PORT}"
uvicorn \ uvicorn \
main:app \ main:app \
--host 0.0.0.0 \ --host 0.0.0.0 \
--port ${FAIRHOPPER_API_PORT} \ --port ${PORT} \
--workers=1 --workers=1

View File

@ -1,5 +1,6 @@
FROM python:3.10.11-alpine3.17 FROM python:3.10.11-alpine3.17
# take arguments
ARG INTERNAL_API_PORT ARG INTERNAL_API_PORT
ARG INTERNAL_WS_PORT ARG INTERNAL_WS_PORT
@ -14,7 +15,7 @@ COPY poetry.lock .
# create virtual environment # create virtual environment
RUN python -m venv /venv RUN python -m venv /venv
# set python thingies and activate virtual environment # set python thingies, set environment variables and activate virtual environment
ENV \ ENV \
PYTHONDONTWRITEBYTECODE=1 \ PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \ PYTHONUNBUFFERED=1 \
@ -28,6 +29,7 @@ RUN \
# install python libs # install python libs
pip install -r requirements.txt --no-cache-dir --prefer-binary pip install -r requirements.txt --no-cache-dir --prefer-binary
# copy all relevant files
COPY ./.docker/* ./ COPY ./.docker/* ./
COPY ./hopper ./hopper COPY ./hopper ./hopper
COPY ./main.py . COPY ./main.py .