mirror of
https://github.com/nikdoof/smsbot.git
synced 2025-12-13 10:02:15 +00:00
Fix docker container
This commit is contained in:
35
Dockerfile
35
Dockerfile
@@ -1,34 +1,21 @@
|
|||||||
FROM python:3.9-alpine AS base
|
FROM python:3.9-alpine AS base
|
||||||
|
|
||||||
|
# Builder
|
||||||
FROM base AS builder
|
FROM base AS builder
|
||||||
|
|
||||||
ENV PYTHONFAULTHANDLER=1 \
|
ENV POETRY_VERSION=2.1.1
|
||||||
PYTHONUNBUFFERED=1 \
|
|
||||||
PYTHONHASHSEED=random \
|
|
||||||
PIP_NO_CACHE_DIR=off \
|
|
||||||
PIP_DISABLE_PIP_VERSION_CHECK=on \
|
|
||||||
PIP_DEFAULT_TIMEOUT=100 \
|
|
||||||
POETRY_NO_INTERACTION=1 \
|
|
||||||
POETRY_VIRTUALENVS_CREATE=false \
|
|
||||||
PATH="$PATH:/runtime/bin" \
|
|
||||||
PYTHONPATH="$PYTHONPATH:/runtime/lib/python3.9/site-packages" \
|
|
||||||
# Versions:
|
|
||||||
POETRY_VERSION=2.1.1
|
|
||||||
|
|
||||||
# System deps:
|
|
||||||
RUN apk add build-base unzip wget python3-dev libffi-dev rust cargo openssl-dev
|
|
||||||
RUN pip install "poetry==$POETRY_VERSION" "poetry-plugin-export"
|
|
||||||
|
|
||||||
|
RUN apk add build-base unzip wget python3-dev libffi-dev rust cargo openssl-dev && pip install "poetry==$POETRY_VERSION" && poetry self add poetry-plugin-bundle
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
COPY poetry.lock pyproject.toml README.md /src/
|
||||||
|
COPY smsbot /src/smsbot
|
||||||
|
RUN poetry bundle venv /runtime
|
||||||
|
|
||||||
# Generate requirements and install *all* dependencies.
|
|
||||||
COPY pyproject.toml poetry.lock /src/
|
|
||||||
RUN poetry export --without-hashes --no-interaction --no-ansi -f requirements.txt -o requirements.txt
|
|
||||||
RUN pip install --prefix=/runtime --force-reinstall -r requirements.txt
|
|
||||||
|
|
||||||
|
# Final container
|
||||||
FROM base AS runtime
|
FROM base AS runtime
|
||||||
COPY --from=builder /runtime /usr/local
|
|
||||||
COPY . /app
|
COPY --from=builder /runtime /runtime
|
||||||
WORKDIR /app
|
ENV PATH=/runtime/bin:$PATH
|
||||||
EXPOSE 8000/tcp
|
EXPOSE 8000/tcp
|
||||||
CMD ["/usr/local/bin/smsbot"]
|
CMD ["smsbot"]
|
||||||
@@ -2,10 +2,8 @@
|
|||||||
name = "smsbot"
|
name = "smsbot"
|
||||||
version = "0.0.5"
|
version = "0.0.5"
|
||||||
description = "A simple Telegram bot to receive SMS messages."
|
description = "A simple Telegram bot to receive SMS messages."
|
||||||
authors = [
|
authors = [{ name = "Andrew Williams", email = "andy@tensixtyone.com" }]
|
||||||
{name = "Andrew Williams",email = "andy@tensixtyone.com"}
|
license = { text = "MIT" }
|
||||||
]
|
|
||||||
license = {text = "MIT"}
|
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.9,<3.10"
|
requires-python = ">=3.9,<3.10"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
@@ -13,12 +11,16 @@ dependencies = [
|
|||||||
"waitress (>=3.0.2,<4.0.0)",
|
"waitress (>=3.0.2,<4.0.0)",
|
||||||
"twilio (>=9.4.6,<10.0.0)",
|
"twilio (>=9.4.6,<10.0.0)",
|
||||||
"python-telegram-bot (<20)",
|
"python-telegram-bot (<20)",
|
||||||
"prometheus-client (>=0.21.1,<0.22.0)"
|
"prometheus-client (>=0.21.1,<0.22.0)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[tool.poetry]
|
||||||
|
packages = [{ include = "smsbot" }]
|
||||||
|
|
||||||
[tool.poetry.scripts]
|
[tool.poetry.scripts]
|
||||||
smsbot = "smsbot.cli:main"
|
smsbot = "smsbot.cli:main"
|
||||||
|
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core>=2.0.0,<3.0.0"]
|
requires = ["poetry-core>=2.0.0,<3.0.0"]
|
||||||
build-backend = "poetry.core.masonry.api"
|
build-backend = "poetry.core.masonry.api"
|
||||||
@@ -33,4 +35,4 @@ pytest-flask = "^1.3.0"
|
|||||||
optional = true
|
optional = true
|
||||||
|
|
||||||
[tool.poetry.group.github.dependencies]
|
[tool.poetry.group.github.dependencies]
|
||||||
pytest-github-actions-annotate-failures = "^0.3.0"
|
pytest-github-actions-annotate-failures = "^0.3.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user