-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Made port in uvicorn script dynamic. Added port to env example.
- Loading branch information
Fjodor van Rijsselberg
authored and
Fjodor van Rijsselberg
committed
Aug 28, 2024
1 parent
16a0a08
commit cae829a
Showing
4 changed files
with
17 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,29 @@ | ||
FROM python:3.12-slim | ||
|
||
ARG BASE_DIR | ||
ARG BASE_DIR=/home/resolution | ||
ARG PORT=9000 | ||
|
||
ENV PORT=${PORT} | ||
ENV BASE_DIR=${BASE_DIR} | ||
ENV PYTHONDONTWRITEBYTECODE=1 | ||
ENV PYTHONUNBUFFERED=1 | ||
|
||
RUN useradd -m resolution | ||
RUN useradd -m -u 1000 -s /bin/bash resolution | ||
|
||
WORKDIR $BASE_DIR | ||
|
||
COPY pyproject.toml . | ||
RUN pip install poetry \ | ||
&& poetry config virtualenvs.create false \ | ||
&& poetry install | ||
&& poetry install --no-root | ||
|
||
USER resolution | ||
COPY . $BASE_DIR/app/ | ||
RUN mkdir -p ${BASE_DIR}/logs \ | ||
&& touch ${BASE_DIR}/logs/prm.log \ | ||
&& chown -R resolution:resolution ${BASE_DIR} | ||
|
||
RUN mkdir -p $BASE_DIR/logs \ | ||
&& touch $BASE_DIR/logs/prm.log | ||
USER resolution | ||
|
||
WORKDIR $BASE_DIR/app | ||
COPY . . | ||
|
||
ENTRYPOINT ["bash", "./run.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
uvicorn main:app --host 0.0.0.0 --port 9000 & | ||
PORT=${PORT:-8080} | ||
uvicorn main:app --host 0.0.0.0 --port "$PORT" & | ||
celery -A main.celery worker -l INFO -Q pid-resolution,pidmr,celery --autoscale=1,10 |