Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
.env
.air

build
build

.vscode
.idea
16 changes: 14 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
# Build stage
FROM cgr.dev/chainguard/go:latest AS builder

WORKDIR /app

COPY go.mod go.sum ./
RUN go mod download

COPY . .
RUN CGO_ENABLED=0 go build -o memogram ./bin/memogram
RUN chmod +x memogram

# Run stage
FROM cgr.dev/chainguard/static:latest-glibc

# Create a non-root user and group
# Chainguard images often run as uid 65532 (nonroot)
USER 65532:65532

WORKDIR /app

ENV SERVER_ADDR=dns:localhost:5230
ENV BOT_TOKEN=your_telegram_bot_token
COPY .env.example .env
COPY --from=builder /app/memogram .

# Copy files with proper ownership
COPY --from=builder --chown=65532:65532 /app /app
COPY --chown=65532:65532 .env.example .env

CMD ["./memogram"]
18 changes: 6 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ ALLOWED_USERNAMES=user1,user2,user3
- `BOT_TOKEN`: Your Telegram bot token
- `BOT_PROXY_ADDR`: Optional proxy address for Telegram API (leave empty if not needed)
- `ALLOWED_USERNAMES`: Optional comma-separated list of allowed usernames (without @ symbol)
- `DATA`: Path to the file storing the user's authentication token

### Username Restrictions

Expand Down Expand Up @@ -89,25 +90,18 @@ Or you can start the service with Docker:

#### Starting with Docker Compose

Or you can start the service with Docker Compose. This can be combined with the `memos` itself in the same compose file:
You can also use Docker Compose to manage the service. There is a sample `docker-compose.yaml` file in this repository
that includes memos and memogram as a quickstart setup.

1. Create a folder where the service will be located.
2. Clone this repository in a subfolder `git clone https://github.com/usememos/telegram-integration memogram`
3. Create `.env` file
```sh
SERVER_ADDR=dns:yourMemosUrl.com:5230
SERVER_ADDR=dns:memos:5230
BOT_TOKEN=your_telegram_bot_token
```
4. Create Docker Compose `docker-compose.yml` file:
```yaml
services:
memogram:
env_file: .env
build: memogram
container_name: memogram
```
5. Run the bot via `docker compose up -d`
6. The Memogram service should now be running inside the Docker container. You can interact with it via your Telegram bot.
4. Run the bot via `docker compose up -d`
5. The Memogram service should now be running inside the Docker container. You can interact with it via your Telegram bot.

### Interaction Commands

Expand Down
21 changes: 21 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
services:
memos:
image: neosmemo/memos:stable
container_name: memos
ports:
- 5230:5230
networks:
- memos-network

memogram:
build: .
env_file: .env
container_name: memogram
depends_on:
- memos
networks:
- memos-network

networks:
memos-network:
name: memos-network