From 23880c9b537269ba1a5a6430a751e0918b3c6426 Mon Sep 17 00:00:00 2001 From: John-Alan Simmons Date: Thu, 4 Apr 2024 02:48:08 -0400 Subject: [PATCH] Added docker file --- Dockerfile | 27 +++++++++++++++++++++++++++ Makefile | 5 ++++- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 Dockerfile 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