From 8b69f421b75638afc3bc4fc249d4028a4d602958 Mon Sep 17 00:00:00 2001 From: Dominik Roos Date: Sun, 28 Jun 2020 13:11:07 +0200 Subject: [PATCH] docker: add Dockerfile (#14) Add docker file and describe how to use dockerized boa. --- Dockerfile | 17 +++++++++++++++++ README.md | 12 ++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5511a78 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM golang:latest as builder + +WORKDIR /boa +COPY go.mod go.sum ./ +RUN go mod download +COPY . . +RUN go build -o ./boa ./cmd/boa + +FROM golang:latest +LABEL maintainer="Dominik Roos " + +ARG WORKDIR=/workdir +RUN mkdir -p ${WORKDIR} +WORKDIR /workdir +COPY --from=builder /boa/boa /usr/local/bin + +ENTRYPOINT ["boa"] diff --git a/README.md b/README.md index 11c6b81..b6f4bd1 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,18 @@ A venom-free generator for cobra applications. go get -u github.com/oncilla/boa/cmd/boa ``` +## Docker + +If you prefer using docker instead: + +```txt +WORKDIR=$(pwd)/path/to/application +docker run \ + -v $WORKDIR/:/workdir \ + --user "$(id -u):$(id -g)" \ + docker.pkg.github.com/oncilla/boa/boa:latest +``` + ## Getting started `boa` proposes a different layout than what `cobra` proposes as a [typical