Last active
February 27, 2017 00:26
-
-
Save f440/926c531bcea26ad0eacbc650a1535387 to your computer and use it in GitHub Desktop.
Makefile for docker project
This file contains hidden or 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
NS ?= $(shell whoami) | |
REPO ?= $(shell basename $(shell pwd)) | |
VERSION ?= latest | |
CONTAINER = $(NS)-$(REPO) | |
.PHONY: build | |
build: | |
docker build -t $(NS)/$(REPO):$(VERSION) . | |
.PHONY: push | |
push: | |
docker push -t $(NS)/$(REPO):$(VERSION) | |
.PHONY: shell | |
shell: | |
docker run -i -t --rm --name $(CONTAINER) --entrypoint /bin/sh $(NS)/$(REPO):$(VERSION) /bin/bash | |
.PHONY: run | |
run: | |
docker run -i -t --rm --name $(CONTAINER) $(NS)/$(REPO):$(VERSION) | |
.PHONY: start | |
start: | |
docker run -d --name $(CONTAINER) $(NS)/$(REPO):$(VERSION) | |
.PHONY: stop | |
stop: | |
docker stop $(CONTAINER) | |
.PHONY: rm | |
rm: | |
docker rm $(CONTAINER) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment