Skip to content
This repository was archived by the owner on Dec 5, 2023. It is now read-only.

Commit 3ecd225

Browse files
authored
Merge pull request #7 from microservices-demo/add_label_schema_0
Adds label-schema.org docker LABELs
2 parents 3be32ee + ac81c39 commit 3ecd225

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ _testmain.go
3838
### Java template
3939
/target/
4040
*.class
41+
*.jar
4142

4243
# Mobile Tools for Java (J2ME)
4344
.mtj.tmp/

docker/shipping/Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,18 @@ FROM java:openjdk-8-alpine
33
WORKDIR /usr/src/app
44
COPY *.jar ./app.jar
55

6+
ARG BUILD_DATE
7+
ARG BUILD_VERSION
8+
ARG COMMIT
9+
10+
LABEL org.label-schema.vendor="Weaveworks" \
11+
org.label-schema.build-date="${BUILD_DATE}" \
12+
org.label-schema.version="${BUILD_VERSION}" \
13+
org.label-schema.name="Socks Shop: Shipping" \
14+
org.label-schema.description="REST API for Shipping service" \
15+
org.label-schema.url="https://github.com/microservices-demo/shipping" \
16+
org.label-schema.vcs-url="github.com:microservices-demo/shipping.git" \
17+
org.label-schema.vcs-ref="${COMMIT}" \
18+
org.label-schema.docker.schema-version="1.0"
19+
620
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/urandom","-jar","./app.jar", "--port=80"]

scripts/build.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
set -ev
44

5+
export BUILD_VERSION="0.0.2-SNAPSHOT"
6+
export BUILD_DATE=`date +%Y-%m-%dT%T%z`
7+
58
SCRIPT_DIR=$(dirname "$0")
69

710
if [[ -z "$GROUP" ]] ; then
@@ -27,5 +30,9 @@ cp $CODE_DIR/target/*.jar $CODE_DIR/docker/$(basename $CODE_DIR)
2730

2831
for m in ./docker/*/; do
2932
REPO=${GROUP}/$(basename $m)
30-
$DOCKER_CMD build -t ${REPO}:${COMMIT} $CODE_DIR/$m;
33+
$DOCKER_CMD build \
34+
--build-arg BUILD_VERSION=$BUILD_VERSION \
35+
--build-arg BUILD_DATE=$BUILD_DATE \
36+
--build-arg COMMIT=$COMMIT \
37+
-t ${REPO}:${COMMIT} $CODE_DIR/$m;
3138
done;

0 commit comments

Comments
 (0)