mirror of
https://github.com/kemko/memes-telegram-integration.git
synced 2026-01-01 15:55:41 +03:00
feat: add Dockerfile (#8)
* feat: add Dockerfile * doc: add using with Docker in README * Update README.md --------- Co-authored-by: Michael <161408495+michaelien@users.noreply.github.com>
This commit is contained in:
17
Dockerfile
Normal file
17
Dockerfile
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# Build stage
|
||||||
|
FROM golang:1.22.2-alpine 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 alpine:latest
|
||||||
|
WORKDIR /app
|
||||||
|
ENV SERVER_ADDR=dns:localhost:5230
|
||||||
|
ENV BOT_TOKEN=your_telegram_bot_token
|
||||||
|
COPY .env.example .env
|
||||||
|
COPY --from=builder /app/memogram .
|
||||||
|
CMD ["./memogram"]
|
||||||
18
README.md
18
README.md
@@ -26,6 +26,8 @@ The `SERVER_ADDR` should be a gRPC server address that the Memos is running on.
|
|||||||
|
|
||||||
### Starting the Service
|
### Starting the Service
|
||||||
|
|
||||||
|
#### Starting with binary
|
||||||
|
|
||||||
1. Download and extract the released binary file;
|
1. Download and extract the released binary file;
|
||||||
2. Create a `.env` file in the same directory as the binary file;
|
2. Create a `.env` file in the same directory as the binary file;
|
||||||
3. Run the executable in the terminal:
|
3. Run the executable in the terminal:
|
||||||
@@ -36,6 +38,22 @@ The `SERVER_ADDR` should be a gRPC server address that the Memos is running on.
|
|||||||
|
|
||||||
4. Once the bot is running, you can interact with it via your Telegram bot.
|
4. Once the bot is running, you can interact with it via your Telegram bot.
|
||||||
|
|
||||||
|
#### Starting with Docker
|
||||||
|
|
||||||
|
Or you can start the service with Docker:
|
||||||
|
|
||||||
|
1. Build the Docker image: `docker build -t memogram .`
|
||||||
|
2. Run the Docker container with the required environment variables:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker run -d --name memogram \
|
||||||
|
-e SERVER_ADDR=dns:localhost:5230 \
|
||||||
|
-e BOT_TOKEN=your_telegram_bot_token \
|
||||||
|
memogram
|
||||||
|
```
|
||||||
|
|
||||||
|
3. The Memogram service should now be running inside the Docker container. You can interact with it via your Telegram bot.
|
||||||
|
|
||||||
### Interaction Commands
|
### Interaction Commands
|
||||||
|
|
||||||
- `/start <access_token>`: Start the bot with your Memos access token.
|
- `/start <access_token>`: Start the bot with your Memos access token.
|
||||||
|
|||||||
Reference in New Issue
Block a user