Skip to content

Commit

Permalink
Update Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
bitwalker committed Jul 1, 2019
1 parent 50ec353 commit ee42fbb
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.PHONY: help

VERSION ?= `cat VERSION`
MAJ_VERSION := $(shell echo $(VERSION) | sed 's/\([0-9][0-9]*\)\.\([0-9][0-9]*\)\(\.[0-9][0-9]*\)*/\1/')
MIN_VERSION := $(shell echo $(VERSION) | sed 's/\([0-9][0-9]*\)\.\([0-9][0-9]*\)\(\.[0-9][0-9]*\)*/\1.\2/')
IMAGE_NAME ?= bitwalker/alpine-elixir-phoenix

help:
Expand All @@ -10,8 +12,19 @@ help:
test: ## Test the Docker image
docker run --rm -it $(IMAGE_NAME):$(VERSION) elixir --version

build: ## Rebuild the Docker image
docker build --force-rm -t $(IMAGE_NAME):$(VERSION) -t $(IMAGE_NAME):latest - < ./Dockerfile
shell: ## Run an Elixir shell in the image
docker run --rm -it $(IMAGE_NAME):$(VERSION) iex

sh: ## Boot to a shell prompt
docker run --rm -it $(IMAGE_NAME):$(VERSION) /bin/bash

build: ## Build the Docker image
docker build --force-rm -t $(IMAGE_NAME):$(VERSION) -t $(IMAGE_NAME):$(MIN_VERSION) -t $(IMAGE_NAME):$(MAJ_VERSION) -t $(IMAGE_NAME):latest - < ./Dockerfile

clean: ## Clean up generated images
@docker rmi --force $(IMAGE_NAME):$(VERSION) $(IMAGE_NAME):$(MIN_VERSION) $(IMAGE_NAME):$(MAJ_VERSION) $(IMAGE_NAME):latest

rebuild: clean build ## Rebuild the Docker image

release: build ## Rebuild and release the Docker image to Docker Hub
docker push $(IMAGE_NAME):$(VERSION)
Expand Down

0 comments on commit ee42fbb

Please sign in to comment.