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:
parent
3a1bb20a1f
commit
34b3156d64
2 changed files with 49 additions and 0 deletions
14
Dockerfile
Normal file
14
Dockerfile
Normal 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" ]
|
35
README.md
35
README.md
|
@ -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
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue