Add Dockerfile
All checks were successful
continuous-integration/drone/push Build is passing

This commit adds a first working Dockerfile for this program, as well as
instructions on how to use it. This will need more detailing in the
future, but this will do for now.
This commit is contained in:
Melora Hugues 2023-01-28 15:11:36 +01:00
parent 3a1bb20a1f
commit 34b3156d64
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.
> 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
```