Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Adding docker image labels and build helper script. #21

Merged
merged 1 commit into from
Apr 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
FROM ubuntu:16.04

ARG COMMIT=""
ARG QUBES_VERSION=""
ARG BUILD_DATE=""

# Label according to https://github.com/opencontainers/image-spec
LABEL org.opencontainers.image.created=${BUILD_DATE}
LABEL org.opencontainers.image.revision=${COMMIT}
LABEL org.opencontainers.image.source="https://github.com/jpmorganchase/qubernetes.git"
LABEL org.opencontainers.image.title="qubernetes"
LABEL org.opencontainers.image.version=${QUBES_VERSION}

RUN apt-get update \
&& apt-get --no-install-recommends install -y apt-utils curl wget git tree ne software-properties-common apt-transport-https ca-certificates build-essential

Expand All @@ -19,3 +30,7 @@ RUN cd /usr/bin && curl -L https://github.com/jpmorganchase/constellation/releas

WORKDIR /qubernetes
COPY . .

# set commit SHA and QUBES_VERSION as ENV vars in last layer
ENV COMMIT_SHA=${COMMIT}
ENV QUBES_VERSION=${QUBES_VERSION}
43 changes: 43 additions & 0 deletions docker-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env sh

# Helper for building dockerhub images from specified git tags.
# ./docker-build.sh v0.1.1 quorumengineering/qubernetes

# To see labels:
# docker image inspect --format='' $IMAGE_NAME

# For debugging all env vars
# printenv

IMAGE_NAME="quorumengineering/qubernetes"
VERSION_TAG="latest"

usage() {
echo "usage: "
echo " docker-build.sh VERSION IMAGE_NAME"
echo " docker-build.sh v0.1.1 quorumengineering/qubernetes"
echo
}

if [[ $# -lt 1 ]]; then
echo " No version or image_name passed in, using defaults. "
echo
usage
echo
fi

if [[ $# -gt 0 ]]; then
VERSION_TAG=$1
fi

if [[ $# -gt 1 ]]; then
IMAGE_NAME=$2
fi

echo "building docker image: "
echo " image: $IMAGE_NAME:$VERSION_TAG "
echo " qube version: $VERSION_TAG"
echo

echo "docker build --no-cache --pull --build-arg=COMMIT=$(git rev-parse --short HEAD) --build-arg=QUBES_VERSION=$VERSION_TAG --build-arg=BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') -t $IMAGE_NAME:$VERSION_TAG ."
docker build --no-cache --pull --build-arg=COMMIT=$(git rev-parse --short HEAD) --build-arg=QUBES_VERSION=$VERSION_TAG --build-arg=BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') -t $IMAGE_NAME:$VERSION_TAG .