-
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
4 changed files
with
29 additions
and
10 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,15 +1,30 @@ | ||
FROM python:3.11.2 as base | ||
FROM python:3.12.0-alpine as build | ||
RUN python -m venv /opt/venv | ||
ENV PATH="/opt/venv/bin:$PATH" | ||
RUN --mount=type=cache,target=/var/cache/apk/ \ | ||
--mount=type=cache,target=/root/.cache/pip \ | ||
--mount=type=bind,source=requirements.txt,target=requirements.txt \ | ||
: \ | ||
&& apk add gcc musl-dev linux-headers \ | ||
&& pip install -U -r requirements.txt | ||
|
||
|
||
FROM python:3.12.0-alpine as base | ||
WORKDIR /app | ||
COPY --from=build /opt/venv /opt/venv | ||
ENV PATH="/opt/venv/bin:$PATH" | ||
ENV PYTHONUNBUFFERED=0 | ||
COPY requirements.txt alembic.ini ./ | ||
RUN pip install -U -r requirements.txt | ||
COPY ./alembic.ini ./ | ||
COPY ./alembic ./alembic | ||
COPY ./src ./ | ||
|
||
|
||
FROM base as prod | ||
COPY ./src ./ | ||
CMD ["/bin/bash", "-c", "alembic upgrade head && python ./main.py bot --sync -c ./config.toml"] | ||
CMD ["/bin/sh", "-c", "alembic upgrade head && python ./main.py bot --sync -c ./config.toml"] | ||
|
||
|
||
FROM base as debug | ||
ENV DEBUG=1 | ||
ENV LOG_LEVEL=DEBUG | ||
RUN pip install debugpy | ||
CMD ["/bin/bash", "-c", "alembic upgrade head && python -m debugpy --wait-for-client --listen 0.0.0.0:5678 ./src/main.py bot -c ./config.toml"] | ||
CMD ["/bin/sh", "-c", "alembic upgrade head && python -m debugpy --wait-for-client --listen 0.0.0.0:5678 ./main.py bot -c ./config.toml"] |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
docker compose --progress quiet up database -d --quiet-pull | ||
docker compose --progress quiet run --rm -t -v "${PWD}/alembic:/app/alembic" mybot alembic "$@" |
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
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