Skip to content

Instantly share code, notes, and snippets.

@alexandrnikitin
Created November 2, 2017 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexandrnikitin/d59a88a27e7b824920054eebd0b1e56a to your computer and use it in GitHub Desktop.
Save alexandrnikitin/d59a88a27e7b824920054eebd0b1e56a to your computer and use it in GitHub Desktop.
Makefile for Dockerfile
NS = docker.repo.com
REPO = image/name
VERSION ?= v0.1.0
NAME = dsp-pricing-data-distribution-build
INSTANCE = default
.PHONY: build push shell run start stop rm tag_latest release
build:
docker build -t $(NS)/$(REPO):$(VERSION) .
push:
docker push $(NS)/$(REPO):$(VERSION)
docker push $(NS)/$(REPO):latest
shell:
docker run --rm --name $(NAME)-$(INSTANCE) -i -t $(PORTS) $(VOLUMES) $(ENV) $(NS)/$(REPO):$(VERSION) /bin/bash
run:
docker run --rm --name $(NAME)-$(INSTANCE) $(PORTS) $(VOLUMES) $(ENV) $(NS)/$(REPO):$(VERSION) $(CMD)
start:
docker run -d --name $(NAME)-$(INSTANCE) $(PORTS) $(VOLUMES) $(ENV) $(NS)/$(REPO):$(VERSION)
stop:
docker stop $(NAME)-$(INSTANCE)
rm:
docker rm $(NAME)-$(INSTANCE)
tag_latest:
docker tag $(NS)/$(REPO):$(VERSION) $(NS)/$(REPO):latest
release: build tag_latest
make push -e VERSION=$(VERSION)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment