diff --git a/Containerfile b/Containerfile new file mode 100644 index 0000000..ae33b1e --- /dev/null +++ b/Containerfile @@ -0,0 +1,9 @@ +FROM registry.suse.com/bci/golang AS build-env +WORKDIR /app +COPY . /app +RUN cd /app && make requirements && make smartbridge-static + +FROM scratch +WORKDIR /data +COPY --from=build-env /app/smartbridge / +ENTRYPOINT ["/smartbridge", "/conf/smartbridge.yml"] \ No newline at end of file diff --git a/Makefile b/Makefile index eec3578..38f9851 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,15 @@ default: all all: smartbridge +requirements: + go mod download + smartbridge: cmd/smartbridge/*.go go build -o $@ $^ +smartbridge-static: cmd/smartbridge/*.go + CGO_ENABLED=0 go build -ldflags="-w -s" -o smartbridge $^ + +.PHONY: container + +container: cmd/smartbridge/*.go + podman build . -t feldspaten.org/smartbridge \ No newline at end of file