Skip to content

Commit 87374a8

Browse files
authored
Merge pull request #20 from igormagalhaesr/docker-compose
docker compose now working
2 parents ff7bdb1 + 577e5ac commit 87374a8

File tree

9 files changed

+480
-177
lines changed

9 files changed

+480
-177
lines changed

Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# --------- requirements ---------
2+
3+
FROM python:3.11 as requirements-stage
4+
5+
WORKDIR /tmp
6+
7+
RUN pip install poetry
8+
9+
COPY src/pyproject.toml src/poetry.lock* /tmp/
10+
11+
RUN poetry export -f requirements.txt --output requirements.txt --without-hashes
12+
13+
14+
# --------- final image build ---------
15+
FROM python:3.11
16+
17+
WORKDIR /code
18+
19+
COPY --from=requirements-stage /tmp/requirements.txt /code/requirements.txt
20+
21+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
22+
23+
COPY ./src/app /code/app
24+
25+
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
26+
27+
# to run with gunicorn and 4 workers use the following:
28+
# CMD ["gunicorn", "app.main:app", "-w", "4", "-k", "uvicorn.workers.UvicornWorker". "-b", "0.0.0.0:8000"]

0 commit comments

Comments
 (0)