From d5b2de8b9ed0cf61a8ccf74d44d296b9cb2557aa Mon Sep 17 00:00:00 2001 From: siddharth Date: Sun, 22 May 2022 13:27:54 -0400 Subject: add Dockerfile --- Dockerfile | 11 +++++++++++ Makefile | 10 +++++++++- bin/Makefile | 12 ++++++++++++ bin/image | 13 +++++++++++++ 4 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 Dockerfile create mode 100644 bin/Makefile create mode 100755 bin/image diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..bb63bf2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: ISC +# Copyright © 2022 siddharth + +FROM golang:1.18.2 + +WORKDIR /usr/src/peach + +COPY . . +RUN make BUILD_OPTS="-v -o /usr/local/bin/peach" + +ENTRYPOINT ["peach"] diff --git a/Makefile b/Makefile index 740b9fd..edbfb2d 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ MOD=ricketyspace.net/peach peach: fmt - go build + go build ${BUILD_OPTS} fmt: go fmt ${MOD} ${MOD}/client ${MOD}/nws @@ -12,3 +12,11 @@ fmt: test: go test ${MOD}/client ${MOD}/nws ${ARGS} .PHONY: test + +clean: + go clean +.PHONY: clean + +image: + ./bin/image +.PHONY: image diff --git a/bin/Makefile b/bin/Makefile new file mode 100644 index 0000000..49e36a1 --- /dev/null +++ b/bin/Makefile @@ -0,0 +1,12 @@ +SH_FILES=image + +all: check fmt +.PHONY: all + +check: + shellcheck -x ${SH_FILES} +.PHONY: check + +fmt: + shfmt -w -i 4 -s ${SH_FILES} +.PHONY: fmt diff --git a/bin/image b/bin/image new file mode 100755 index 0000000..8a98eb4 --- /dev/null +++ b/bin/image @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +# +# SPDX-License-Identifier: ISC +# Copyright © 2022 siddharth + +REPO="public.ecr.aws/w3h8c8i8/peach" +TAG=$(date +%Y%m%d%H%M%S) +if [ -z "$TAG" ]; then + echo "TAG empty" + exit 1 +fi + +docker build -t "$REPO":"$TAG" . -- cgit v1.2.3