diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3811d1c --- /dev/null +++ b/Dockerfile @@ -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"] diff --git a/gismeteo/app.py b/gismeteo/app.py index c902d1a..312c2ab 100644 --- a/gismeteo/app.py +++ b/gismeteo/app.py @@ -6,7 +6,7 @@ from fastapi import FastAPI from gismeteo.route import api, doc, view -locale.setlocale(locale.LC_TIME, "ru_RU.UTF-8") +# locale.setlocale(locale.LC_TIME, "ru_RU.UTF-8") app = FastAPI(docs_url=None, redoc_url=None) doc.mount(app) diff --git a/scripts/build b/scripts/build new file mode 100755 index 0000000..68a9e40 --- /dev/null +++ b/scripts/build @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +set -e +cd "$(dirname $(dirname "$0"))" || exit + +docker build -t shmyga/weather . diff --git a/scripts/publish b/scripts/publish new file mode 100755 index 0000000..e1023ca --- /dev/null +++ b/scripts/publish @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -e +cd "$(dirname $(dirname "$0"))" || exit + +IMAGE_NAME=shmyga/weather + +docker tag $IMAGE_NAME instreamatic.com:8083/$IMAGE_NAME +docker push instreamatic.com:8083/$IMAGE_NAME diff --git a/scripts/run b/scripts/run new file mode 100755 index 0000000..e9a5dea --- /dev/null +++ b/scripts/run @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +set -e +cd "$(dirname $(dirname "$0"))" || exit + +docker run --rm -p 8000:80 shmyga/weather