Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
docker-makefile-sample
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sample
docker-makefile-sample
Commits
580f262f
Commit
580f262f
authored
Mar 04, 2020
by
Chavee Issariyapat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
do 3 tags after build
parent
68ffdc67
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
7 deletions
+22
-7
Makefile
+22
-7
No files found.
Makefile
View file @
580f262f
...
@@ -74,6 +74,15 @@ define MAKEFUNCTIONCODE
...
@@ -74,6 +74,15 @@ define MAKEFUNCTIONCODE
function
getVersion()
{
function
getVersion()
{
result
=
$
$(getRelease)
result
=
$
$(getRelease)
if
hasChanges
;
then
result
=
"
$$
result-dirty"
fi
echo
$$result
}
function
getVersionWithHash()
{
result
=
$
$(getRelease)
if
differsFromRelease;
then
if
differsFromRelease;
then
# output only first 7 characters
# output only first 7 characters
# result="$$result-$$(git log -n 1 --format=%h .)"
# result="$$result-$$(git log -n 1 --format=%h .)"
...
@@ -117,6 +126,7 @@ SHELL=/bin/bash
...
@@ -117,6 +126,7 @@ SHELL=/bin/bash
include
release.conf
include
release.conf
IMAGE
=
$(REGISTRY_HOST)
/
$(GROUPNAME)
/
$(PROJECTNAME)
IMAGE
=
$(REGISTRY_HOST)
/
$(GROUPNAME)
/
$(PROJECTNAME)
VERSION
=
$(
shell
.
$(RELEASE_SUPPORT)
;
getVersion
)
VERSION
=
$(
shell
.
$(RELEASE_SUPPORT)
;
getVersion
)
VERSIONHASH
=
$(
shell
.
$(RELEASE_SUPPORT)
;
getVersionWithHash
)
TAG
=
$(
shell
.
$(RELEASE_SUPPORT)
;
getTag
)
TAG
=
$(
shell
.
$(RELEASE_SUPPORT)
;
getTag
)
PROJECTPATH
?=
.
PROJECTPATH
?=
.
...
@@ -172,15 +182,19 @@ post-init:
...
@@ -172,15 +182,19 @@ post-init:
@
rm .make-function
@
rm .make-function
docker-build
:
docker-build
:
docker build
-t
$(IMAGE)
:
$(VERSION)
$(PROJECTPATH)
docker build
-t
$(IMAGE)
:
$(VERSION
HASH
)
$(PROJECTPATH)
@
DOCKER_MAJOR
=
$(
shell
docker
-v
| sed
-e
's/.*version //'
-e
's/,.*//'
| cut
-d
\.
-f1
)
;
\
@
DOCKER_MAJOR
=
$(
shell
docker
-v
| sed
-e
's/.*version //'
-e
's/,.*//'
| cut
-d
\.
-f1
)
;
\
DOCKER_MINOR
=
$(
shell
docker
-v
| sed
-e
's/.*version //'
-e
's/,.*//'
| cut
-d
\.
-f2
)
;
\
DOCKER_MINOR
=
$(
shell
docker
-v
| sed
-e
's/.*version //'
-e
's/,.*//'
| cut
-d
\.
-f2
)
;
\
if
[
$$
DOCKER_MAJOR
-eq
1
]
&&
[
$$
DOCKER_MINOR
-lt
10
]
;
then
\
if
[
$$
DOCKER_MAJOR
-eq
1
]
&&
[
$$
DOCKER_MINOR
-lt
10
]
;
then
\
echo
docker tag
-f
$(IMAGE)
:
$(VERSION)
$(IMAGE)
:latest
;
\
echo
docker tag
-f
$(IMAGE)
:
$(VERSIONHASH)
$(IMAGE)
:latest
;
\
docker tag
-f
$(IMAGE)
:
$(VERSION)
$(IMAGE)
:latest
;
\
docker tag
-f
$(IMAGE)
:
$(VERSIONHASH)
$(IMAGE)
:latest
;
\
echo
docker tag
-f
$(IMAGE)
:
$(VERSIONHASH)
$(IMAGE)
:
$(VERSION)
;
\
docker tag
-f
$(IMAGE)
:
$(VERSIONHASH)
$(IMAGE)
:
$(VERSION)
;
\
else
\
else
\
echo
docker tag
$(IMAGE)
:
$(VERSION)
$(IMAGE)
:latest
;
\
echo
docker tag
$(IMAGE)
:
$(VERSIONHASH)
$(IMAGE)
:latest
;
\
docker tag
$(IMAGE)
:
$(VERSION)
$(IMAGE)
:latest
;
\
docker tag
$(IMAGE)
:
$(VERSIONHASH)
$(IMAGE)
:latest
;
\
echo
docker tag
$(IMAGE)
:
$(VERSIONHASH)
$(IMAGE)
:
$(VERSION)
;
\
docker tag
$(IMAGE)
:
$(VERSIONHASH)
$(IMAGE)
:
$(VERSION)
;
\
fi
fi
release
:
check-status check-release build push
release
:
check-status check-release build push
...
@@ -192,17 +206,18 @@ rmi: delete-docker-image
...
@@ -192,17 +206,18 @@ rmi: delete-docker-image
images
:
list-docker-image
images
:
list-docker-image
do-push
:
do-push
:
docker push
$(IMAGE)
:
$(VERSIONHASH)
docker push
$(IMAGE)
:
$(VERSION)
docker push
$(IMAGE)
:
$(VERSION)
docker push
$(IMAGE)
:latest
docker push
$(IMAGE)
:latest
build-push
:
build push
build-push
:
build push
show-tag
:
init release.conf
show-tag
:
init release.conf
@
.
$(RELEASE_SUPPORT)
;
getVersion
@
.
$(RELEASE_SUPPORT)
;
getVersion
WithHash
@
rm .make-function
@
rm .make-function
showtag
:
init release.conf
showtag
:
init release.conf
@
.
$(RELEASE_SUPPORT)
;
getVersion
@
.
$(RELEASE_SUPPORT)
;
getVersion
WithHash
@
rm .make-function
@
rm .make-function
# tag-patch-release: init
# tag-patch-release: init
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment