use env variables, containerfile

This commit is contained in:
stryan 2022-08-10 21:19:34 -04:00
parent 5353570475
commit c13f1ecea5
3 changed files with 31 additions and 0 deletions

7
.containerignore Normal file
View File

@ -0,0 +1,7 @@
.git
.gitignore
Dockerfile*
Containerfile*
README.md
LICENSE
*.yaml

13
Containerfile Normal file
View File

@ -0,0 +1,13 @@
FROM golang:1.18 as builder
WORKDIR /go/src/app
COPY . .
RUN apt update && apt upgrade -y
RUN go build
FROM alpine:latest as final
WORKDIR /srv/
RUN mkdir /srv/dota_patch_bot
RUN mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2
COPY --from=builder /go/src/app/dota_patch_bot /srv/dota_patch_bot/
CMD ["/srv/dota_patch_bot/dota_patch_bot"]

11
main.go
View File

@ -8,6 +8,7 @@ import (
"io/ioutil"
"log"
"net/http"
"os"
"time"
)
@ -105,6 +106,16 @@ func main() {
var currentPatch patch
flag.Parse()
if *hookPtr == "" {
if val, ok := os.LookupEnv("DOTA_WEBHOOK"); ok {
*hookPtr = val
}
}
if *sourcePtr == "" {
if val, ok := os.LookupEnv("DOTA_PATCH_SOURCE"); ok {
*sourcePtr = val
}
}
loadPatches(&patchlist, *sourcePtr)
if len(patchlist.Patches) <= 0 {