Revert LICENSE and README.md changes, update Dockerfile to use multi-stage build with uv

Co-authored-by: nikdoof <170514+nikdoof@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-07-17 17:20:13 +00:00
parent 59aadd22c1
commit 816ef7fd06
3 changed files with 50 additions and 33 deletions

View File

@@ -1,16 +1,22 @@
FROM python:3.9-alpine FROM python:3.9-alpine AS base
# Builder
FROM base AS builder
# Install uv # Install uv
# Note: In some build environments, you may need to add --trusted-host flags for SSL RUN pip install uv
RUN pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org uv
WORKDIR /app WORKDIR /src
COPY uv.lock pyproject.toml README.md /app/ COPY uv.lock pyproject.toml README.md /src/
COPY smsbot /app/smsbot COPY smsbot /src/smsbot
# Install dependencies # Create virtual environment and install dependencies
# Note: In some environments, you may need to configure SSL certificates
RUN uv sync --frozen --no-dev RUN uv sync --frozen --no-dev
# Final container
FROM base AS runtime
COPY --from=builder /src/.venv /runtime
ENV PATH=/runtime/bin:$PATH
EXPOSE 80/tcp EXPOSE 80/tcp
CMD ["uv", "run", "smsbot"] CMD ["smsbot"]

View File

@@ -1,6 +1,7 @@
The MIT License (MIT) MIT License
Copyright (c) 2016 Andrey Nering Copyright (c) 2019 Five B
Copyright (c) 2022 Andrew Williams <andy@tensixtyone.com>
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,27 +1,37 @@
<div align="center"> # SMSBot
<a href="https://taskfile.dev">
<img src="website/static/img/logo.svg" width="200px" height="200px" />
</a>
<h1>Task</h1> A simple Telegram bot to receive SMS messages.
<p> Forked from [FiveBoroughs/Twilio2Telegram](https://github.com/FiveBoroughs/Twilio2Telegram).
Task is a task runner / build tool that aims to be simpler and easier to use than, for example, <a href="https://www.gnu.org/software/make/">GNU Make<a>.
</p>
<p> ## Functionality
<a href="https://taskfile.dev/installation/">Installation</a> | <a href="https://taskfile.dev/usage/">Documentation</a> | <a href="https://twitter.com/taskfiledev">Twitter</a> | <a href="https://bsky.app/profile/taskfile.dev">Bluesky</a> | <a href="https://fosstodon.org/@task">Mastodon</a> | <a href="https://discord.gg/6TY36E39UK">Discord</a>
</p>
<h1>Gold Sponsors</h1> This simple tool acts as a webhook receiver for the Twilio API, taking messages sent over and posting them on Telegram to a target chat or channel. This is useful for forwarding on 2FA messages, notification text messages for services that don't support international numbers (*cough* Disney, of all people).
<table> The bot is designed to run within a Kubernetes environment, but can be operated as a individual container, or as a hand ran service.
<tr>
<td align="center" valign="middle"> ## Configuration
<a target="_blank" href="https://devowl.io">
<img src="/website/static/img/devowl.io.svg" height="100px" title="devowl.io" /> All configuration is provided via environment variables
</a>
</td> | Variable | Required? | Description |
</tr> | -------------------------- | --------- | --------------------------------------------------------------------------- |
</table> | SMSBOT_DEFAULT_SUBSCRIBERS | No | A list of IDs, seperated by commas, to add to the subscribers list on start |
</div> | SMSBOT_LISTEN_HOST | No | The host for the webhooks to listen on, defaults to `0.0.0.0` |
| SMSBOT_LISTEN_PORT | No | The port to listen to, defaults to `80` |
| SMSBOT_OWNER_ID | No | ID of the owner of this bot |
| SMSBOT_TELEGRAM_BOT_TOKEN | Yes | Your Bot Token for Telegram |
| SMSBOT_TWILIO_AUTH_TOKEN | No | Twilio auth token, used to validate any incoming webhook calls |
## Setup
To configure SMSBot, you'll need a Twilio account, either paid or trial is fine.
* Setup a number in the location you want.
* Under Phone Numbers -> Manage -> Active Numbers, click the number you want to setup.
* In the "Voice & Fax" section, update the "A Call Comes In" to the URL of your SMSBot instance, with the endpoint being `/call`, e.g. `http://mymachine.test.com/call`
* In the "Messaging" section, update the "A Message Comes In" to the URL of your SMSBot instance, with the endpoint being `/message`, e.g. `http://mymachine.test.com/message`
Your bot should now receive messages, on Telegram you need to start a chat or invite it into any channels you want, then update the `SMSBOT_DEFAULT_SUBSCRIBERS` values with their IDs.
**Note**: You cannot send test messages from your Twilio account to your Twilio numbers, they'll be silently dropped or fail with an "Invalid Number" error.