Skip to content

Commit 5e29eb0

Browse files
committed
Update
1 parent 3d4bb1c commit 5e29eb0

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

Dockerfile

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11

22

3-
FROM --platform=linux/amd64 python:3.9.7 as environment
3+
FROM --platform=linux/amd64 python:3.9-slim-buster as environment
44
ARG DEBIAN_FRONTEND=noninteractive
55

66
# Configure Poetry
77
ENV POETRY_VERSION=1.3.2
88
ENV POETRY_HOME=/app/poetry
99
ENV POETRY_VENV=/app/poetry-venv
10+
ENV PATH="/app/poetry-venv/bin:$PATH"
1011
ENV POETRY_CACHE_DIR=/app/.cache
1112

1213
# Install poetry separated from system interpreter
@@ -30,7 +31,7 @@ RUN /bin/bash -c 'source $POETRY_VENV/bin/activate && \
3031
poetry install --no-root'
3132

3233

33-
FROM --platform=linux/amd64 python:3.9.7 as test
34+
FROM --platform=linux/amd64 python:3.9-slim-buster as test
3435

3536
WORKDIR /app
3637
#COPY --from=indexing_environment $POETRY_VENV $POETRY_VENV
@@ -42,13 +43,19 @@ COPY . FN-Basic-Services
4243
ENTRYPOINT ["/app/FN-Basic-Services/docker-run-tests.sh"]
4344

4445

45-
FROM --platform=linux/amd64 python:3.9.7 as runtime
46+
FROM --platform=linux/amd64 python:3.9-slim-buster as runtime
4647

4748
WORKDIR /app
49+
4850
#COPY --from=indexing_environment $POETRY_VENV $POETRY_VENV
4951
COPY --from=environment /app .
5052
COPY . FN-Basic-Services
5153

52-
# RUN chmod +x /app/FN-Basic-Services/*.sh
54+
# Enable venv
55+
ENV PATH="/app/poetry-venv/bin:$PATH"
56+
57+
# ENTRYPOINT ["/app/FN-Basic-Services/docker-run-entrypoints.sh"]
58+
# CMD ["gunicorn", "--bind", "0.0.0.0:8888", "main:app"]
5359

54-
ENTRYPOINT ["/app/FN-Basic-Services/docker-run-entrypoints.sh"]
60+
# Command to run Gunicorn with Uvicorn workers
61+
CMD ["gunicorn", "-w", "4", "--worker-class", "uvicorn.workers.UvicornWorker", "-b", "0.0.0.0:8888", "-t", "30", "--pythonpath", "/app/FN-Basic-Services", "main:app"]

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ sudo service k8s_es_api status/stop/start
9191

9292

9393
### Service
94-
- Run this command `./start-start.sh` or python -m uvicorn main:app --reload --host=0.0.0.0 --port=8888 --workers 4
94+
- Run this command `./start-start.sh` or `python -m uvicorn main:app --reload --host=0.0.0.0 --port=8888 --workers 4`
95+
- Run Dockerfile: `CMD ["gunicorn", "-w", "4", "--worker-class", "uvicorn.workers.UvicornWorker", "-b", "0.0.0.0:8888", "-t", "30", "--pythonpath", "/app/FN-Basic-Services", "main:app"]`
9596
- Service : http://localhost:8888/docs
9697

9798

docker-run-entrypoints.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ set -ex
33

44
# sleep 60
55

6+
echo "entrypoints.sh"
7+
68
# --
79
# Poetry v.
810
# --

main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ def custom_openapi():
5959
description="Default GET API",
6060
summary="Return Json")
6161
async def root():
62+
logger.info("/hello")
6263
return {"message": "Hello World from openapi.yml"}
6364

6465
'''

0 commit comments

Comments
 (0)