65 lines
2.0 KiB
Docker
65 lines
2.0 KiB
Docker
# --- Stage 1: Python Backend dev ---
|
|
FROM python:3.14-slim AS dev
|
|
|
|
LABEL org.opencontainers.image.title="The-DisExcel-project-dev"
|
|
LABEL org.opencontainers.image.source="https://git.homyk.space/MH.Dmitrii/The_DisExcel_project"
|
|
|
|
WORKDIR /home/excel-project
|
|
|
|
COPY pyproject.toml poetry.lock docker/entrypoint.sh ./
|
|
|
|
RUN chmod +x ./entrypoint.sh
|
|
|
|
RUN pip install --no-cache-dir --break-system-packages poetry \
|
|
&& poetry config virtualenvs.create false \
|
|
&& poetry install --no-root --no-interaction
|
|
|
|
# --- Stage 2: Python Backend prod ---
|
|
|
|
FROM python:3.14-slim AS prod
|
|
|
|
LABEL org.opencontainers.image.title="The-DisExcel-project-prod"
|
|
LABEL org.opencontainers.image.source="https://git.homyk.space/MH.Dmitrii/The_DisExcel_project"
|
|
|
|
WORKDIR /home/excel-project
|
|
|
|
COPY pyproject.toml poetry.lock main.py docker/entrypoint.sh ./
|
|
COPY src/ ./src/
|
|
|
|
RUN chmod +x ./entrypoint.sh
|
|
|
|
RUN pip install --no-cache-dir --break-system-packages poetry \
|
|
&& poetry config virtualenvs.create false \
|
|
&& poetry install --no-root --no-interaction --only main
|
|
|
|
RUN groupadd --gid 1000 appuser \
|
|
&& useradd --uid 1000 --gid appuser --shell /bin/bash --create-home appuser \
|
|
&& chown -R appuser:appuser /home/excel-project
|
|
|
|
USER appuser
|
|
|
|
ENTRYPOINT ["./entrypoint.sh", "--prod"]
|
|
|
|
|
|
FROM python:3.14-slim AS migration-tool
|
|
|
|
LABEL org.opencontainers.image.title="The-DisExcel-project"
|
|
LABEL org.opencontainers.image.source="https://git.homyk.space/MH.Dmitrii/The_DisExcel_project"
|
|
|
|
WORKDIR /home/excel-project
|
|
|
|
COPY pyproject.toml poetry.lock alembic.ini ./
|
|
COPY src/models/database_models ./src/models/database_models
|
|
COPY src/models/configs_read ./src/models/configs_read
|
|
|
|
RUN pip install --no-cache-dir --break-system-packages poetry \
|
|
&& poetry config virtualenvs.create false \
|
|
&& poetry install --no-root --no-interaction --only main
|
|
|
|
RUN groupadd --gid 1000 appuser \
|
|
&& useradd --uid 1000 --gid appuser --shell /bin/bash --create-home appuser \
|
|
&& chown -R appuser:appuser /home/excel-project
|
|
|
|
USER appuser
|
|
|
|
CMD ["alembic", "upgrade", "head"] |