diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/epg-cacher.exe b/epg-cacher.exe deleted file mode 100644 index f298830..0000000 Binary files a/epg-cacher.exe and /dev/null differ diff --git a/src/Dockerfile b/src/Dockerfile new file mode 100644 index 0000000..33ce267 --- /dev/null +++ b/src/Dockerfile @@ -0,0 +1,25 @@ +FROM --platform=$BUILDPLATFORM golang:1.25.1-alpine AS build +ARG TARGETOS +ARG TARGETARCH + +WORKDIR /src + +COPY go.mod go.sum ./ +RUN --mount=type=cache,target=/go/pkg/mod \ + go mod download + +COPY . . + +RUN --mount=type=cache,target=/root/.cache/go-build \ + CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH \ + go build -trimpath -ldflags="-s -w" -o /out/app . + +FROM gcr.io/distroless/static-debian12:nonroot + +COPY --from=build /out/app /app + +USER nonroot:nonroot + +# EXPOSE 8080 + +ENTRYPOINT ["/app"] \ No newline at end of file diff --git a/README.md b/src/README.md similarity index 100% rename from README.md rename to src/README.md diff --git a/app.go b/src/app.go similarity index 96% rename from app.go rename to src/app.go index 59397cc..f1ce77e 100644 --- a/app.go +++ b/src/app.go @@ -176,13 +176,8 @@ func main() { if port == "" { port = "8080" } - - exePath, err := os.Executable() - if err != nil { - log.Fatalf("failed to get executable path: %v", err) - } - exeDir := filepath.Dir(exePath) - cacheFilePath := filepath.Join(exeDir, "cache.xml") + + cacheFilePath := filepath.Join(os.TempDir(), "cache.xml") cache := &Cache{ filePath: cacheFilePath, diff --git a/go.mod b/src/go.mod similarity index 100% rename from go.mod rename to src/go.mod diff --git a/src/go.sum b/src/go.sum new file mode 100644 index 0000000..e69de29