-
-
Notifications
You must be signed in to change notification settings - Fork 83
/
Makefile
30 lines (30 loc) · 1.25 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
SHELL := /usr/bin/env bash
ARGS := $(filter-out $@,$(MAKECMDGOALS))
IMAGE_ORG := ea31337
IMAGE_NAME := ea-tester
DOCKER_TAG := latest
DOCKER_TAR := ${HOME}/.docker/images.tar.gz
DOCKER_CFG := ${HOME}/.docker/config.json
BUILD_DATE := $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
BUILD_VREF := $(shell git rev-parse --short HEAD)
.PHONY: docker-load docker-build docker-login docker-tag docker-pull docker-push docker-run docker-save docker-clean
docker-ci: docker-build
docker-load:
if [[ -f $(DOCKER_TAR) ]]; then gzip -dc $(DOCKER_TAR) | docker load; fi
docker-build:
docker build -t ${IMAGE_NAME}:$(DOCKER_TAG) --build-arg BUILD_DATE=$(BUILD_DATE) --build-arg VCS_REF=$(BUILD_VREF) --build-arg VERSION=$(DOCKER_TAG) .
docker-login:
if [[ "$(DOCKER_PASSWORD)" ]]; then docker login -u $(DOCKER_USERNAME) --password-stdin <<<"$(DOCKER_PASSWORD)"; fi
docker-tag:
docker tag ${IMAGE_NAME}:$(DOCKER_TAG) $(IMAGE_ORG)/$(IMAGE_NAME):$(DOCKER_TAG)
docker-pull:
docker pull $(IMAGE_ORG)/$(IMAGE_NAME):$(DOCKER_TAG)
docker-push: docker-login docker-tag
docker images
docker push $(IMAGE_ORG)/$(IMAGE_NAME):$(DOCKER_TAG)
docker-run:
docker run -it ${IMAGE_NAME} bash
docker-save:
docker save ${IMAGE_NAME} | gzip > $(DOCKER_TAR)
docker-clean:
docker system prune -af