Skip to content

Commit

Permalink
refactor: remove build timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
Midnighter committed May 26, 2020
1 parent a9fd264 commit 4c1690e
Show file tree
Hide file tree
Showing 6 changed files with 145 additions and 123 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ env:
- BRANCH=${TRAVIS_BRANCH}
- BUILD_COMMIT=${TRAVIS_COMMIT}
- SHORT_COMMIT=${TRAVIS_COMMIT:0:7}
- BUILD_TIMESTAMP=$(date -u +%Y-%m-%dT%T+00:00)
- BUILD_DATE=$(date -u +%Y-%m-%d)
- BUILD_TAG=${BRANCH}_${BUILD_DATE}_${SHORT_COMMIT}

Expand Down
10 changes: 4 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@ FROM dddecaf/wsgi-base:${BASE_TAG}

ARG BASE_TAG=alpine
ARG BUILD_COMMIT
ARG BUILD_TIMESTAMP

LABEL dk.dtu.biosustain.id-mapper.alpine.vendor="Novo Nordisk Foundation \
Center for Biosustainability, Technical University of Denmark" \
maintainer="[email protected]" \
dk.dtu.biosustain.id-mapper.alpine.build.base-tag="${BASE_TAG}" \
dk.dtu.biosustain.id-mapper.alpine.build.commit="${BUILD_COMMIT}" \
dk.dtu.biosustain.id-mapper.alpine.build.timestamp="${BUILD_TIMESTAMP}"
Center for Biosustainability, Technical University of Denmark"
LABEL maintainer="[email protected]"
LABEL dk.dtu.biosustain.id-mapper.alpine.build.base-tag="${BASE_TAG}"
LABEL dk.dtu.biosustain.id-mapper.alpine.build.commit="${BUILD_COMMIT}"

ARG CWD="/app"

Expand Down
2 changes: 1 addition & 1 deletion LATEST_BASE_TAG
Original file line number Diff line number Diff line change
@@ -1 +1 @@
alpine_2020-04-29_467416e
alpine_2020-05-26_7beedaa
8 changes: 3 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ IMAGE ?= gcr.io/dd-decaf-cfbf6/id-mapper
BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
BUILD_COMMIT ?= $(shell git rev-parse HEAD)
SHORT_COMMIT ?= $(shell git rev-parse --short HEAD)
# Full timestamp in UTC. Format corresponds to ISO-8601 but Unix compatible.
BUILD_TIMESTAMP ?= $(shell date -u +%Y-%m-%dT%T+00:00)
BUILD_DATE ?= $(shell date -u +%Y-%m-%d)
BUILD_TAG ?= ${BRANCH}_${BUILD_DATE}_${SHORT_COMMIT}

Expand All @@ -28,7 +26,7 @@ setup: network
## Generate the compiled requirements files.
lock:
docker pull dddecaf/tag-spy:latest
$(eval LATEST_BASE_TAG := $(shell docker run --rm dddecaf/tag-spy:latest tag-spy dddecaf/wsgi-base alpine dk.dtu.biosustain.wsgi-base.alpine.build.timestamp))
$(eval LATEST_BASE_TAG := $(shell docker run --rm dddecaf/tag-spy:latest tag-spy dddecaf/wsgi-base alpine))
$(file >LATEST_BASE_TAG, $(LATEST_BASE_TAG))
$(eval COMPILER_TAG := $(subst alpine,alpine-compiler,$(LATEST_BASE_TAG)))
$(info ************************************************************)
Expand Down Expand Up @@ -57,9 +55,9 @@ build-travis:
$(info * depend on a later version.)
$(info ************************************************************)
docker pull dddecaf/wsgi-base:$(LATEST_BASE_TAG)
docker build --build-arg BASE_TAG=$(LATEST_BASE_TAG) \
docker build \
--build-arg BASE_TAG=$(LATEST_BASE_TAG) \
--build-arg BUILD_COMMIT=$(BUILD_COMMIT) \
--build-arg BUILD_TIMESTAMP=$(BUILD_TIMESTAMP) \
--tag $(IMAGE):$(BRANCH) \
--tag $(IMAGE):$(BUILD_TAG) \
.
Expand Down
5 changes: 2 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ services:
context: .
dockerfile: Dockerfile
args:
- BASE_TAG=${BASE_TAG}
- BASE_TAG=${BASE_TAG:-alpine}
- BUILD_COMMIT=${BUILD_COMMIT:-unknown}
- BUILD_TIMESTAMP=${BUILD_TIMESTAMP:-unknown}
image: gcr.io/dd-decaf-cfbf6/id-mapper:${IMAGE_TAG:-latest}
image: gcr.io/dd-decaf-cfbf6/id-mapper:${BUILD_TAG:-latest}
networks:
default:
DD-DeCaF:
Expand Down
Loading

0 comments on commit 4c1690e

Please sign in to comment.