mirror of
				https://github.com/cheat/cheat.git
				synced 2025-11-04 07:45:28 +01:00 
			
		
		
		
	feat(Docker): create development Docker image
- Create Docker image to be used for experimentation during development - Create targets in `Makefile` pertaining to the above
This commit is contained in:
		
							
								
								
									
										8
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							@@ -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
 | 
			
		||||
							
								
								
									
										14
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								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:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user