-
-
Save benfavre/29aafb4b6b3a9c04ba57d995d2903c97 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