Skip to content

Commit

Permalink
feat: Change to multi-stage docker
Browse files Browse the repository at this point in the history
  • Loading branch information
sebimarkgraf committed Jun 6, 2024
1 parent 5bf36b6 commit b0e5710
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 17 deletions.
26 changes: 18 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
FROM python:3.10
ARG PYTHON_BASE=3.10-slim

FROM python:$PYTHON_BASE as builder

MAINTAINER Sebastian Moßburger <sebastian-markgraf@t-online.de>

WORKDIR /backend
COPY pyproject.toml .
RUN pip install pdm
RUN pdm install
# Copy project
COPY . .


# Run uvicorn
CMD ["pdm", "run", "uvicorn", "--host", "0.0.0.0", "src.backend:app", "--port", "42069"]
RUN pip install -U pdm

COPY pyproject.toml pdm.lock README.md src/ .
# Required for PDM install of package
RUN pdm install --check --prod --no-editable


FROM python:$PYTHON_BASE

COPY --from=builder /backend/.venv/ /backend/.venv/
ENV PATH="/backend/.venv/bin:$PATH"

COPY src/ /backend/src/

CMD ["fastapi", "run", "/backend/src/whatsapp_transcribe/__main__.py", "--port", "80"]
3 changes: 3 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ services:
whatsapp-transcribe:
build: .
restart: always
env_file: .env
ports:
- 80:80

tunnel:
image: cloudflare/cloudflared
Expand Down
18 changes: 9 additions & 9 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dependencies = [
"fastapi>=0.111.0",
"twilio>=9.0.5",
"langchain>=0.2.1",
"langchain-community>=0.2.3",
]
requires-python = ">=3.9"
readme = "README.md"
Expand Down

0 comments on commit b0e5710

Please sign in to comment.