diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ffd6b8e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +# NB: this image isn't used anywhere in the build pipeline. It exists to +# conveniently facilitate ad-hoc experimentation in a sandboxed environment +# during development. +FROM golang:1.15-alpine + +RUN apk add git less make + +WORKDIR /app diff --git a/Makefile b/Makefile index ae279ad..78c0cc9 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ dist_dir := ./dist CAT := cat COLUMN := column CTAGS := ctags +DOCKER := docker GO := go GREP := grep GZIP := gzip --best @@ -20,6 +21,8 @@ SED := sed SORT := sort ZIP := zip -m +docker_image := cheat-devel:latest + # build flags BUILD_FLAGS := -ldflags="-s -w" -mod vendor -trimpath GOBIN := @@ -105,6 +108,7 @@ clean: $(dist_dir) .PHONY: distclean distclean: $(RM) -f tags + @$(DOCKER) image rm -f $(docker_image) ## setup: install revive (linter) and scc (sloc tool) .PHONY: setup @@ -165,6 +169,16 @@ check: | vendor fmt lint vet test .PHONY: prepare prepare: | $(dist_dir) clean generate vendor fmt lint vet test +## docker-setup: create a docker image for use during development +.PHONY: docker-setup +docker-setup: + $(DOCKER) build -t $(docker_image) -f Dockerfile . + +## docker-sh: shell into the docker development container +.PHONY: docker-sh +docker-sh: + $(DOCKER) run -v $(shell pwd):/app -ti $(docker_image) /bin/ash + ## help: display this help text .PHONY: help help: