This repository has been archived by the owner on Jan 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
59 lines (45 loc) · 1.75 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#===============================================================================
# Default User Options
#===============================================================================
# Build-time arguments
SPACK_IMAGE ?= "spack/ubuntu-bionic"
SPACK_VERSION ?= "latest"
# Target
TARGET ?= "x86_64"
# Image name
DOCKER_IMAGE ?= leavesask/antmoc-ci
DOCKER_TAG := 0.1.15
# Default user
USER_NAME ?= hpcer
#===============================================================================
# Variables and objects
#===============================================================================
BUILD_DATE=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
VCS_URL=$(shell git config --get remote.origin.url)
# Get the latest commit
GIT_COMMIT = $(strip $(shell git rev-parse --short HEAD))
#===============================================================================
# Targets to Build
#===============================================================================
.PHONY : docker_build docker_push output
default: build
build: docker_build output
release: docker_build docker_push output
docker_build:
# Build Docker image
docker build \
--build-arg SPACK_IMAGE=$(SPACK_IMAGE) \
--build-arg SPACK_VERSION=$(SPACK_VERSION) \
--build-arg TARGET=$(TARGET) \
--build-arg BUILD_DATE=$(BUILD_DATE) \
--build-arg VCS_URL=$(VCS_URL) \
--build-arg VCS_REF=$(GIT_COMMIT) \
-t $(DOCKER_IMAGE):$(DOCKER_TAG) .
docker_push:
# Tag image as latest
docker tag $(DOCKER_IMAGE):$(DOCKER_TAG) $(DOCKER_IMAGE):latest
# Push to DockerHub
docker push $(DOCKER_IMAGE):$(DOCKER_TAG)
docker push $(DOCKER_IMAGE):latest
output:
@echo Docker Image: $(DOCKER_IMAGE):$(DOCKER_TAG)