diff --git a/scnserver/Dockerfile b/scnserver/Dockerfile index bf2e879..ede78a5 100644 --- a/scnserver/Dockerfile +++ b/scnserver/Dockerfile @@ -1,6 +1,14 @@ +FROM golang as builder + +WORKDIR /repo +COPY . /repo + +RUN make build + FROM debian:bookworm -COPY _build/scn_backend /app/scnserver +COPY --from=builder /repo/_build/scn_backend /app/scnserver + COPY DOCKER_GIT_INFO /app/DOCKER_GIT_INFO RUN mkdir /data diff --git a/scnserver/Makefile b/scnserver/Makefile index 1c83064..51e9533 100644 --- a/scnserver/Makefile +++ b/scnserver/Makefile @@ -5,7 +5,7 @@ PORT=9090 NAMESPACE=$(shell git rev-parse --abbrev-ref HEAD) HASH=$(shell git rev-parse HEAD) -.PHONY: test swagger pygmentize +.PHONY: test swagger pygmentize docker build: swagger pygmentize fmt mkdir -p _build @@ -21,7 +21,7 @@ gow: which gow || go install github.com/mitranim/gow@latest gow -e "go,mod,html,css,json,yaml,js" run -tags "timetzdata sqlite_fts5 sqlite_foreign_keys" blackforestbytes.com/simplecloudnotifier/cmd/scnserver -docker: build +docker: [ ! -f "DOCKER_GIT_INFO" ] || rm DOCKER_GIT_INFO git rev-parse --abbrev-ref HEAD >> DOCKER_GIT_INFO git rev-parse HEAD >> DOCKER_GIT_INFO