Merge pull request 'Add Containerfile' (#2) from cont into master

Reviewed-on: https://codeberg.org/grisu48/meteo/pulls/2
This commit is contained in:
Felix Niederwanger 2023-02-01 15:53:13 +00:00
commit 8226f622fa
3 changed files with 25 additions and 0 deletions

14
Containerfile Normal file
View file

@ -0,0 +1,14 @@
FROM golang:alpine AS builder
WORKDIR /app
ADD . /app
RUN apk update && apk add build-base
RUN cd /app && CGO_ENABLED=0 go build -ldflags="-w -s" -o meteod ./...
FROM scratch
WORKDIR /app
COPY --from=builder /app/meteod /meteod
VOLUME "/conf"
ENTRYPOINT ["/meteod"]
CMD ["-c", "/conf/meteod.conf"]

View file

@ -8,5 +8,8 @@ install: all
meteod: cmd/meteod/*.go
go build -o $@ $^
container: meteod
podman build . -t codeberg.org/grisu48/meteo
## === Tests ================================================================ ##

View file

@ -59,3 +59,11 @@ OPTIONS
--token TOKEN Set influxdb token
--http BINDADDR Enable http server on the given address
```
## container image
You can run `meteod` as container image from codeberg.org. Create a [meteod.conf](meteod.conf.example) configuration file, and run the container in the container engine of your choise:
podman run --name meteo -v /path/to/your/meteod.conf:/conf/meteod.conf -p 4042:4042 codeberg.org/grisu48/meteo
That's it!