Add image labels dynamically

This commit is contained in:
Arthur Barr
2017-10-26 13:27:26 +01:00
parent 9a05a1d5d1
commit 721c2e616e
2 changed files with 7 additions and 13 deletions

View File

@@ -14,10 +14,6 @@
FROM ubuntu:16.04 FROM ubuntu:16.04
ARG IBM_PRODUCT_ID
ARG IBM_PRODUCT_NAME
ARG IBM_PRODUCT_VERSION
# The URL to download the MQ installer from in tar.gz format # The URL to download the MQ installer from in tar.gz format
# This assumes an archive containing the MQ Debian (.deb) install packages # This assumes an archive containing the MQ Debian (.deb) install packages
ARG MQ_URL ARG MQ_URL
@@ -25,14 +21,12 @@ ARG MQ_URL
# The MQ packages to install # The MQ packages to install
ARG MQ_PACKAGES="ibmmq-server ibmmq-java ibmmq-jre ibmmq-gskit ibmmq-msg-.* ibmmq-samples ibmmq-ams" ARG MQ_PACKAGES="ibmmq-server ibmmq-java ibmmq-jre ibmmq-gskit ibmmq-msg-.* ibmmq-samples ibmmq-ams"
LABEL "ProductID"=$IBM_PRODUCT_ID \
"ProductName"=$IBM_PRODUCT_NAME \
"ProductVersion"=$IBM_PRODUCT_VERSION
COPY install-mq.sh /usr/local/bin/ COPY install-mq.sh /usr/local/bin/
# Install MQ. To avoid a "text file busy" error here, we sleep before installing.
RUN chmod u+x /usr/local/bin/install-mq.sh \ RUN chmod u+x /usr/local/bin/install-mq.sh \
# To avoid a "text file busy" error here we sleep before installing. && sleep 1 \
&& sleep 1 && install-mq.sh && install-mq.sh
COPY build/runmqserver /usr/local/bin/ COPY build/runmqserver /usr/local/bin/
COPY build/chkmq* /usr/local/bin/ COPY build/chkmq* /usr/local/bin/

View File

@@ -126,9 +126,9 @@ define docker-build-mq
--file $2 \ --file $2 \
--network build \ --network build \
--build-arg MQ_URL=http://build:80/$3 \ --build-arg MQ_URL=http://build:80/$3 \
--build-arg IBM_PRODUCT_ID=$4 \ --label IBM_PRODUCT_ID=$4 \
--build-arg IBM_PRODUCT_NAME=$5 \ --label IBM_PRODUCT_NAME=$5 \
--build-arg IBM_PRODUCT_VERSION=$6 \ --label IBM_PRODUCT_VERSION=$6 \
. .
# Stop the web server (will also remove the container) # Stop the web server (will also remove the container)
$(DOCKER) kill $(BUILD_SERVER_CONTAINER) $(DOCKER) kill $(BUILD_SERVER_CONTAINER)