diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..23bfed1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +FROM golang:1.21-bookworm as builder + +# Setup env and dev tools +RUN apt update &&\ + apt-get install --yes git make + +WORKDIR /app + +# Cache deps +COPY go.* /app/ +RUN go mod download + +# Build +COPY . /app +#ENV GOFLAGS='-buildvcs=false' +RUN --mount=type=cache,target=/root/.cache make build + + +# Deployment entrypoint +FROM debian:bookworm-slim + +RUN useradd -ms /bin/bash node +USER node + +COPY --from=builder /app/build/orbisd /usr/local/bin/orbisd + +ENTRYPOINT ["orbisd"] \ No newline at end of file diff --git a/Makefile b/Makefile index 5a7e9ac..ffcae87 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,9 @@ -docker: +ko: KO_DOCKER_REPO=ko.local ko build -B --platform=linux/$$(go env GOARCH) ./cmd/orbisd +docker: + docker build -t orbisd . + .PHONY: build build: go build -o build/orbisd ./cmd/orbisd