build(docker): add Dockerfile

This commit is contained in:
2024-07-26 00:04:07 +03:00
parent b3d88997eb
commit c9e52c43a9
5 changed files with 37 additions and 1 deletions

18
Dockerfile Normal file
View File

@@ -0,0 +1,18 @@
FROM python:3.12 AS builder
ENV POETRY_HOME="/opt/poetry"
ENV PATH="$POETRY_HOME/bin:$PATH"
WORKDIR /app
RUN curl -sSL https://install.python-poetry.org | python3 -
COPY pyproject.toml poetry.lock ./
RUN poetry config virtualenvs.in-project true
RUN poetry install --with app
FROM python:3.12-slim
ENV PATH="/app/.venv/bin:$PATH"
WORKDIR /app
RUN apt update && apt install -y locales
RUN locale-gen ru_RU.UTF-8 && dpkg-reconfigure locales
COPY --from=builder /app ./
COPY gismeteo gismeteo/
CMD ["uvicorn", "gismeteo.app:app", "--host", "0.0.0.0", "--port", "80"]