From 63c76074a37e412069bd2a700989ba7f839c9edd Mon Sep 17 00:00:00 2001 From: Vicente Zepeda Mas Date: Fri, 14 Aug 2020 14:08:02 +0200 Subject: [PATCH 1/3] Testing docker hooks --- Dockerfile | 9 ++++++++- hooks/VERSION | 1 + hooks/build | 8 ++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 hooks/VERSION create mode 100755 hooks/build diff --git a/Dockerfile b/Dockerfile index 796744d..78050cd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,11 @@ -FROM alpine:3.8 +FROM alpine:3.12 +ARG BUILD_DATE +ARG VCS_REF +ARG VERSION +LABEL org.label-schema.build-date=$BUILD_DATE \ + org.label-schema.vcs-ref=$VCS_REF \ + org.label-schema.vcs-url="https://github.com/chentex/random-logger" \ + org.label-schema.version=$VERSION RUN apk add --no-cache bc COPY ./entrypoint.sh / ENTRYPOINT ["/entrypoint.sh"] diff --git a/hooks/VERSION b/hooks/VERSION new file mode 100644 index 0000000..afaf360 --- /dev/null +++ b/hooks/VERSION @@ -0,0 +1 @@ +1.0.0 \ No newline at end of file diff --git a/hooks/build b/hooks/build new file mode 100755 index 0000000..dad9c17 --- /dev/null +++ b/hooks/build @@ -0,0 +1,8 @@ +#!/bin/bash + +export VERSION=$(cat hooks/VERSION) + +docker build --build-arg VCS_REF=`git rev-parse —-short HEAD` \ + --build-arg BUILD_DATE=`date -u +”%Y-%m-%dT%H:%M:%SZ”` \ + --build-arg VERSION=$VERSION \ + -f Dockerfile -t chentex/random-logger:$VERSION \ No newline at end of file From 458d71f8388b99c34f764615ecfd2a11a8844902 Mon Sep 17 00:00:00 2001 From: Vicente Zepeda Mas Date: Fri, 14 Aug 2020 14:19:08 +0200 Subject: [PATCH 2/3] Fix docker hooks --- LICENSE | 2 +- hooks/build | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/LICENSE b/LICENSE index 74377e9..be597d4 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2016 Vicente Zepeda +Copyright (c) 2020 Vicente Zepeda Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/hooks/build b/hooks/build index dad9c17..6575eef 100755 --- a/hooks/build +++ b/hooks/build @@ -2,7 +2,7 @@ export VERSION=$(cat hooks/VERSION) -docker build --build-arg VCS_REF=`git rev-parse —-short HEAD` \ +docker build --build-arg VCS_REF=`git rev-parse --short HEAD` \ --build-arg BUILD_DATE=`date -u +”%Y-%m-%dT%H:%M:%SZ”` \ --build-arg VERSION=$VERSION \ - -f Dockerfile -t chentex/random-logger:$VERSION \ No newline at end of file + -f Dockerfile -t chentex/random-logger:$VERSION . \ No newline at end of file From c8c7d01edf43a2f67c472e2ad1c4a105f092e8a3 Mon Sep 17 00:00:00 2001 From: Vicente Zepeda Mas Date: Fri, 14 Aug 2020 15:13:38 +0200 Subject: [PATCH 3/3] Update tagging method --- hooks/build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hooks/build b/hooks/build index 6575eef..a6f382c 100755 --- a/hooks/build +++ b/hooks/build @@ -1,8 +1,9 @@ #!/bin/bash export VERSION=$(cat hooks/VERSION) +export IMAGE_NAME="chentex/random-logger" docker build --build-arg VCS_REF=`git rev-parse --short HEAD` \ --build-arg BUILD_DATE=`date -u +”%Y-%m-%dT%H:%M:%SZ”` \ --build-arg VERSION=$VERSION \ - -f Dockerfile -t chentex/random-logger:$VERSION . \ No newline at end of file + -f Dockerfile -t $IMAGE_NAME:v$VERSION -t $IMAGE_NAME:latest . \ No newline at end of file