Add Dockerfile #12

Merged
faercol merged 1 commit from add-docker into main 2023-01-28 14:13:45 +00:00
2 changed files with 49 additions and 0 deletions

14
Dockerfile Normal file
View file

@ -0,0 +1,14 @@
FROM golang:1.19 AS builder
WORKDIR /go/src/git.faercol.me/public-ip-tracker/
COPY tracker ./
RUN CGO_ENABLED=0 make build
# Replace with from scratch later on
FROM alpine:latest
WORKDIR /root
COPY --from=builder go/src/git.faercol.me/public-ip-tracker/build/tracker ./
VOLUME [ "/config" ]
ENTRYPOINT [ "./tracker" ]
CMD [ "-config", "/config/config.json" ]

View file

@ -27,3 +27,38 @@ The relevant channel is monitored during the program execution. This allows the
command to the bot in order to get the current public IP on-demand. command to the bot in order to get the current public IP on-demand.
> Insert example here > Insert example here
## Deploy
### Configuration file
For now, the program is configured through a JSON configuration file. Here is a sample :
```json
{
"telegram": {
"token": "<your_bot_token>",
"channel_id": 9999999
},
"polling_frequency": 5
}
```
### Docker
You can use the provided Dockerfile to build your own image.
```bash
docker build -t public-ip-tracker .
```
You can then use the provided configuration file sample, and provide it to the program using the
`/config` volume
> I might add support for environment variables in the future.
```bash
docker run -it -v /path/to/your/dir/with/json/file:/config public-ip-tracker
```