Browse Source

Add support for building and publishing two different Docker images (latest vs dev) (#693)

Co-authored-by: James Mills <prologic@shortcircuit.net.au>
Reviewed-on: #693
Co-authored-by: James Mills <james@mills.io>
Co-committed-by: James Mills <james@mills.io>
pull/696/head
James Mills 1 week ago
parent
commit
4b7ae5db6b
  1. 15
      Makefile

15
Makefile

@ -4,9 +4,18 @@
export CGO_ENABLED=0
VERSION=$(shell git describe --abbrev=0 --tags 2>/dev/null || echo "$VERSION")
COMMIT=$(shell git rev-parse --short HEAD || echo "$COMMIT")
BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
GOCMD=go
GOVER=$(shell go version | grep -o -E 'go1\.17\.[0-9]+')
ifeq ($(BRANCH), master)
IMAGE := prologic/yarnd
TAG := latest
else
IMAGE := prologic/yarnd
TAG := dev
endif
all: preflight build
preflight:
@ -52,11 +61,11 @@ install: build
ifeq ($(PUBLISH), 1)
image:
@docker build --build-arg VERSION="$(VERSION)" --build-arg COMMIT="$(COMMIT)" -t prologic/yarnd .
@docker push prologic/yarnd
@docker build --build-arg VERSION="$(VERSION)" --build-arg COMMIT="$(COMMIT)" -t $(IMAGE):$(TAG) .
@docker push $(IMAGE):$(TAG)
else
image:
@docker build --build-arg VERSION="$(VERSION)" --build-arg COMMIT="$(COMMIT)" -t prologic/yarnd .
@docker build --build-arg VERSION="$(VERSION)" --build-arg COMMIT="$(COMMIT)" -t $(IMAGE):$(TAG) .
endif
release:

Loading…
Cancel
Save