-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docker): execute db migration on docker compose
- Loading branch information
1 parent
97d8ddf
commit 3c77c58
Showing
2 changed files
with
44 additions
and
0 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
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,34 @@ | ||
ARG PYTHON_VERSION_CODE=3.10 | ||
ARG ENVIRONMENT="dev" | ||
# ENVIRONMENT: dev or prod, refer to project.optional-dependencies in pyproject.toml | ||
|
||
FROM python:${PYTHON_VERSION_CODE}-bookworm as builder | ||
ARG PYTHON_VERSION_CODE | ||
ARG ENVIRONMENT | ||
|
||
WORKDIR /app | ||
ENV PYTHONDONTWRITEBYTECODE=1 \ | ||
PYTHONUNBUFFERED=1 | ||
|
||
COPY pyproject.toml README.md ./ | ||
COPY birdxplorer_migration/__init__.py ./birdxplorer_migration/ | ||
RUN pip install --no-cache-dir -e ".[${ENVIRONMENT}]" | ||
|
||
COPY --from=ghcr.io/ufoscout/docker-compose-wait:latest /wait /wait | ||
|
||
FROM python:${PYTHON_VERSION_CODE}-slim-bookworm as runner | ||
ARG PYTHON_VERSION_CODE | ||
|
||
WORKDIR /app | ||
|
||
RUN groupadd -r app && useradd -r -g app app | ||
RUN chown -R app:app /app | ||
USER app | ||
|
||
|
||
COPY --from=builder /wait /wait | ||
COPY --from=builder /usr/local/lib/python${PYTHON_VERSION_CODE}/site-packages /usr/local/lib/python${PYTHON_VERSION_CODE}/site-packages | ||
COPY --chown=app:app . ./ | ||
|
||
ENV WAIT_COMMAND="python birdxplorer_migration/scripts/migrations/migrate_all.py birdxplorer_migration/data/appv1/" | ||
ENTRYPOINT ["/wait"] |