This repository has been archived by the owner on Aug 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.deprecated
64 lines (51 loc) · 2.03 KB
/
Makefile.deprecated
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
60
61
62
63
64
#===============================================================================
# Default User Options
#===============================================================================
# Build-time arguments
BASE_IMAGE ?= gcc
BASE_TAG ?= 9.2.0
OMPI_VMAJOR ?= 4.0
OMPI_VMINOR ?= 0
OMPI_OPTIONS ?= "--enable-mpi-cxx --enable-shared"
# Image name
DOCKER_IMAGE ?= leavesask/gompi
DOCKER_TAG := $(OMPI_VMAJOR).$(OMPI_VMINOR)
#===============================================================================
# Variables and objects
#===============================================================================
# Append a suffix to the tag if the version number of GCC
# is specified
ifneq ($(BASE_TAG),latest)
DOCKER_TAG := $(DOCKER_TAG)-gcc-$(BASE_TAG)
endif
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 BASE_IMAGE=$(BASE_IMAGE) \
--build-arg BASE_TAG=$(BASE_TAG) \
--build-arg OMPI_VMAJOR=$(OMPI_VMAJOR) \
--build-arg OMPI_VMINOR=$(OMPI_VMINOR) \
--build-arg OMPI_OPTIONS=$(OMPI_OPTIONS) \
--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)