-
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.
- Loading branch information
Showing
1 changed file
with
22 additions
and
6 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,10 +1,26 @@ | ||
# syntax=docker/dockerfile:1 | ||
FROM python:3.10-slim-buster | ||
FROM python:3.10.5-slim-bullseye as builder | ||
|
||
WORKDIR /app | ||
COPY makefile bot.py pyproject.toml ./ | ||
COPY pyproject.toml ./ | ||
|
||
RUN python -m venv --copies venv | ||
ENV PATH="/app/venv/bin:$PATH" | ||
|
||
RUN pip install "poetry==1.1.13" --no-cache-dir && \ | ||
poetry config virtualenvs.create false && \ | ||
poetry install --no-dev --no-root --no-interaction --no-ansi && \ | ||
pip uninstall --yes poetry && \ | ||
pip cache purge && \ | ||
rm -rf ~/.cache/pypoetry/{cache,artifacts} | ||
|
||
FROM python:3.10.5-slim-bullseye as prod | ||
|
||
COPY --from=builder /app/venv app/venv | ||
ENV PATH="/app/venv/bin:$PATH" | ||
|
||
WORKDIR /app | ||
COPY bot.py ./ | ||
COPY hnread ./hnread | ||
RUN pip install "poetry==1.1.13" --no-cache-dir \ | ||
&& poetry config virtualenvs.create false \ | ||
&& poetry install --no-dev --no-root --no-interaction --no-ansi \ | ||
&& rm -rf ~/.cache/pypoetry/{cache,artifacts} | ||
|
||
CMD ["python", "bot.py"] |