Public | Automated Build

Last pushed: 2 years ago
Short Description
Short description is empty for this repo.
Full Description
DOCKER_IMAGE := archiron

DOCKER_ENVS := 

DOCKER_ID := $(shell docker images --quiet="true" --filter="label=name=$(DOCKER_IMAGE)")

DOCKER_PS := $(shell docker ps -a --quiet="true" --filter="label=name=$(DOCKER_IMAGE)")

DOCKER_SHELL := "bash"

DOCKER_PORT_CONTAINER := 3000

DOCKER_PORT_HOTE := 80

ifneq "$(DOCKER_PS)" ""
    DOCKER_IP_CONTAINER := $(shell docker inspect --format '{{ .NetworkSettings.IPAddress }}' $(DOCKER_PS))
ifneq "$(shell command -v boot2docker)" ""
        DOCKER_IP_HOTE := $(shell boot2docker ip)
else
        DOCKER_IP_HOTE := $(shell docker inspect --format  '{{range $$p, $$conf := .NetworkSettings.Ports}}{{(index $$conf 0).HostIp}}{{end}}' $(DOCKER_PS))
endif
endif

default: build run

build:
    docker build -t "$(DOCKER_IMAGE)" . ;

ifneq "$(DOCKER_PS)" ""
run:
    docker run --rm -it -p $(DOCKER_PORT_HOTE):$(DOCKER_PORT_CONTAINER) $(DOCKER_ENVS) "$(DOCKER_IMAGE)" ;
else
run: build
    docker run --rm -it -p $(DOCKER_PORT_HOTE):$(DOCKER_PORT_CONTAINER) $(DOCKER_ENVS) "$(DOCKER_IMAGE)" ;
endif

shell:
    docker run --rm -it -p $(DOCKER_PORT_HOTE):$(DOCKER_PORT_CONTAINER) "$(DOCKER_IMAGE)" $(DOCKER_SHELL) ;

stop:
    docker stop $(DOCKER_PS) ;

rm:
    docker rm $(DOCKER_PS) ;

ifeq "$(DOCKER_PS)" ""
rmi:
    docker rmi $(DOCKER_ID) ;
else
rmi: rm
    docker rmi $(DOCKER_ID) ;
endif

ip:
    @echo "$(DOCKER_IP_HOTE):$(DOCKER_PORT_HOTE)->$(DOCKER_IP_CONTAINER):$(DOCKER_PORT_CONTAINER)" ;

.PHONY: default build run shell stop rm rmi ip
Docker Pull Command
Owner
adjivas
Source Repository

Comments (0)