build(docker): add Dockerfile
This commit is contained in:
18
Dockerfile
Normal file
18
Dockerfile
Normal 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"]
|
||||
@@ -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)
|
||||
|
||||
5
scripts/build
Executable file
5
scripts/build
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
cd "$(dirname $(dirname "$0"))" || exit
|
||||
|
||||
docker build -t shmyga/weather .
|
||||
8
scripts/publish
Executable file
8
scripts/publish
Executable file
@@ -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
|
||||
5
scripts/run
Executable file
5
scripts/run
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
cd "$(dirname $(dirname "$0"))" || exit
|
||||
|
||||
docker run --rm -p 8000:80 shmyga/weather
|
||||
Reference in New Issue
Block a user