Skip to content

Commit c5d520f

Browse files
authored
[FIX] Adapt Dockerfile to poetry (#18)
1 parent b1c4832 commit c5d520f

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

Dockerfile

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
FROM python:3.11-alpine
1+
# Limitation:
2+
# - Big image size: uses poetry, gets the whole repo, ...
3+
# - No caching/multi-stage build: the whole image is rebuilt every time
4+
# Done this way for easier mapping AWS AppRunner from GitHub source <-> Dockerfile
25

3-
COPY requirements.txt requirements.txt
6+
ARG PYTHON_VERSION
47

5-
RUN pip install -r requirements.txt
8+
FROM python:${PYTHON_VERSION}-slim as builder
69

7-
COPY ./api ./api
8-
COPY application_config.yaml application_config.yaml
10+
WORKDIR /app
911

10-
CMD ["uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "80"]
12+
COPY . /app/
13+
RUN chmod +x /app/scripts/setup.sh && /app/scripts/setup.sh
14+
CMD ["poetry", "run", "serve"]

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ types-pyyaml = "^6.0.12.20240917"
4444
moto = "^5.0.21"
4545

4646
[build-system]
47-
requires = ["poetry-core"]
47+
requires = ["poetry-core=1.8.4"]
4848
build-backend = "poetry.core.masonry.api"
4949

5050
[tool.poetry.scripts]

0 commit comments

Comments
 (0)