diff --git a/Dockerfile b/Dockerfile index efce144..0ce380e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -53,5 +53,12 @@ ENV PATH="/opt/google-cloud-sdk/bin:/opt/spannerbox/bin:$PATH" \ SPANNER_DATABASE_ID=test-database \ SPANNER_EMULATOR_HOST=0.0.0.0:9010 +LABEL org.opencontainers.image.url="iromli/spannerbox" \ + org.opencontainers.image.authors="isman.firmansyah@gmail.com" \ + org.opencontainers.image.vendor="" \ + org.opencontainers.image.version="1.1.0" \ + org.opencontainers.image.title="Spannerbox" \ + org.opencontainers.image.description="spannerbox is a set of tools to work with Spanner emulator" + ENTRYPOINT ["tini", "-g", "--"] CMD ["emulator"] diff --git a/Makefile b/Makefile index d46aba6..29cc4d0 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,10 @@ -# default image name -IMAGE_NAME?=iromli/spannerbox -VERSION=$(shell cat version.txt | cut -d '-' -f 1)-dev +IMAGE_VERSION?=$(shell grep -Po 'org.opencontainers.image.version="\K.*?(?=")' Dockerfile)-dev +IMAGE_URL=$(shell grep -Po 'org.opencontainers.image.url="\K.*?(?=")' Dockerfile) +IMAGE?=${IMAGE_URL}:${IMAGE_VERSION} -.DEFAULT_GOAL:=build +.PHONY: test clean all build +.DEFAULT_GOAL := build build: - @echo "[I] Building image ${IMAGE_NAME}:${VERSION}" - @docker build --rm --force-rm -t ${IMAGE_NAME}:${VERSION} . + @echo "[I] Building image ${IMAGE}" + @docker build --rm --force-rm -t ${IMAGE} .