Skip to content

Instantly share code, notes, and snippets.

@alexandrnikitin
Created November 2, 2017 15:00
Show Gist options
  • Select an option

  • Save alexandrnikitin/d59a88a27e7b824920054eebd0b1e56a to your computer and use it in GitHub Desktop.

Select an option

Save alexandrnikitin/d59a88a27e7b824920054eebd0b1e56a to your computer and use it in GitHub Desktop.

Revisions

  1. alexandrnikitin created this gist Nov 2, 2017.
    36 changes: 36 additions & 0 deletions Makefile.docker
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,36 @@
    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)