Created
July 14, 2019 20:17
-
-
Save eslam-mahmoud/9ae8397d1ae2d94d8a825c39edc95065 to your computer and use it in GitHub Desktop.
sample #2 Makefile for tutorial
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NAME=executable | |
VERSION=1 | |
GO_IMAGE=eslammahmoud/test:$(VERSION) | |
# Docker container that will be used to create the vendor folder and binary | |
GO_ENV=docker run -it --rm -v $(PWD):/app -w /app golang:1.8 | |
all: push | |
# Create the executable file | |
$(NAME): | |
$(GO_ENV) go build -o ./$(NAME) | |
build: $(NAME) #alias to run the command as $make build | |
# build the development docker image | |
release: $(NAME) | |
docker build -t $(GO_IMAGE) . | |
# push new go service release | |
push: release | |
docker push $(GO_IMAGE) | |
clean: | |
- rm -rf ./$(NAME) | |
- docker rmi $(GO_IMAGE) | |
.PHONY: build release push clean |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment