diff --git a/.azure-pipelines/all-images.yml b/.azure-pipelines/all-images.yml index 5656ed9..7bebf17 100644 --- a/.azure-pipelines/all-images.yml +++ b/.azure-pipelines/all-images.yml @@ -6,32 +6,30 @@ parameters: steps: # OpenXR spec builder - - script: docker pull ruby:2.3 - displayName: Pull ruby:2.3 base image - - template: build-template.yml parameters: command: ${{ parameters.command }} - tag: openxr-base.202110 + tag: openxr-base + version: 202110 - template: build-template.yml parameters: command: ${{ parameters.command }} - tag: openxr.202110 + tag: openxr + version: 202110 # OpenXR SDK builder - - script: docker pull ubuntu:18.04 - displayName: Pull ubuntu:18.04 base image - - template: build-template.yml parameters: command: ${{ parameters.command }} - tag: openxr-sdk.202110 + tag: openxr-sdk + version: 202110 - template: build-template.yml parameters: command: ${{ parameters.command }} - tag: openxr-pregenerated-sdk.202201 + tag: openxr-pregenerated-sdk + version: 202201 # This image build is broken right now: E: Package 'ttf-lyx' has no installation candidate # - template: build-template.yml diff --git a/.azure-pipelines/azure-pipelines.yml b/.azure-pipelines/azure-pipelines.yml index 8ea0629..a49932c 100644 --- a/.azure-pipelines/azure-pipelines.yml +++ b/.azure-pipelines/azure-pipelines.yml @@ -9,20 +9,3 @@ jobs: - template: all-images.yml parameters: command: build - - # push job - runs only on master - - job: build_and_push - condition: eq(variables['build.sourceBranch'], 'refs/heads/master') - pool: - vmImage: "ubuntu-latest" - steps: - - - task: Docker@2 - displayName: Login to Docker Hub - inputs: - command: login - containerRegistry: docker-hub - - - template: all-images.yml - parameters: - command: buildAndPush diff --git a/.azure-pipelines/build-template.yml b/.azure-pipelines/build-template.yml index 19e712f..5e6a484 100644 --- a/.azure-pipelines/build-template.yml +++ b/.azure-pipelines/build-template.yml @@ -6,12 +6,16 @@ parameters: imageName: "khronosgroup/docker-images" tag: command: build + version: steps: - task: Docker@2 - displayName: ${{ parameters.command }} ${{ parameters.tag }} + displayName: ${{ parameters.command }} ${{ parameters.tag }} ${{ parameters.version }} inputs: repository: ${{ parameters.imageName }} command: ${{ parameters.command }} - tags: ${{ parameters.tag }} - Dockerfile: Dockerfile.${{ parameters.tag }} + arguments: "--build-arg \"VERSION=${{ parameters.version }}\"" + tags: | + ${{ parameters.tag }}.latest + ${{ parameters.tag }}.${{ parameters.version }} + Dockerfile: ${{ parameters.tag }}.Dockerfile diff --git a/README.md b/README.md index 9729b99..9b6129f 100644 --- a/README.md +++ b/README.md @@ -4,23 +4,25 @@ Docker container specifications which package dependencies for building Khronos documentation and software. Images built from this github repository are pushed to the Dockerhub -repository +repository https://hub.docker.com/r/khronosgroup/docker-images. -https://hub.docker.com/r/khronosgroup/docker-images +## Structure -Each Dockerfile is named in the form 'Dockerfile.' or -'.dockerfile', where (e.g. `openxr`, `asciidoctor-spec`) matches -the tag for that image in the Dockerhub repository. +Each Dockerfile is named `.Dockerfile` where `` (e.g. `openxr`, `asciidoctor-spec`) +matches the tag for that image in the Dockerhub repository, suffixed with both `-latest` for the +latest revision of this image, and `-` representing a timestamp when this image was last +modified. ## Scripts -In general, any additional arguments are forwarded on to `docker build`, -so this is how you can pass `--no-cache` to force a rebuild, etc. +In general, any additional arguments are forwarded on to `docker build` except the first if it is +`"push"`, so this is how you can pass `--no-cache` to force a rebuild, etc. -- Single-image scripts: pass a Dockerfile name as the first argument, the tag is automatically computed. - - `./build-one.sh` - Just builds and tags the image locally, does not push to Dockerhub. +- Single-image scripts: pass a tag name as the first argument and a version as the second. + - `./build-one.sh ` - Just builds and tags the image locally, does not push to Dockerhub. Use for testing modifications. - - `./build-and-push-one.sh` - Builds and tags the image locally, then pushes it to Dockerhub. + - `./build-one.sh push` - Builds and tags the image locally, then pushes it to Dockerhub. Only run this once you've committed (and ideally, pushed) the corresponding changes to this Git repo. -- `./build-and-push-all.sh` - Just calls `./build-and-push-one.sh` on the Dockerfiles listed in it. +- `./build-all.sh` - Just calls `./build-one.sh` on all the tags listed in it. Use as `./build-all.sh push` + to push all images to Dockerhub. If you add a new Dockerfile to this repo, add it to this script too. diff --git a/asciidoctor-spec.dockerfile b/asciidoctor-spec.Dockerfile similarity index 100% rename from asciidoctor-spec.dockerfile rename to asciidoctor-spec.Dockerfile diff --git a/build-all.sh b/build-all.sh new file mode 100755 index 0000000..30cae2e --- /dev/null +++ b/build-all.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Copyright 2019-2021 The Khronos Group Inc. +# SPDX-License-Identifier: Apache-2.0 + +set -e + +( + cd $(dirname $0) + ./build-one.sh asciidoctor-spec 202206 "$@" + ./build-one.sh vulkan-docs-base 202206 "$@" + ./build-one.sh vulkan-docs 202206 "$@" + ./build-one.sh openxr-base 202110 "$@" + ./build-one.sh openxr 202110 "$@" + ./build-one.sh openxr-sdk 202110 "$@" + ./build-one.sh openxr-pregenerated-sdk 202201 "$@" +) diff --git a/build-and-push-all.sh b/build-and-push-all.sh deleted file mode 100755 index c07e622..0000000 --- a/build-and-push-all.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# Copyright 2019-2021 The Khronos Group Inc. -# SPDX-License-Identifier: Apache-2.0 - -set -e - -( - cd $(dirname $0) - ./build-and-push-one.sh asciidoctor-spec.dockerfile "$@" - ./build-and-push-one.sh vulkan-docs-base.dockerfile "$@" - ./build-and-push-one.sh vulkan-docs.dockerfile "$@" - ./build-and-push-one.sh Dockerfile.openxr-base.202102 "$@" - ./build-and-push-one.sh Dockerfile.openxr.202102 "$@" - ./build-and-push-one.sh Dockerfile.openxr-sdk.202102 "$@" - ./build-and-push-one.sh Dockerfile.openxr-pregenerated-sdk-base.202102 "$@" - ./build-and-push-one.sh Dockerfile.openxr-pregenerated-sdk.202102 "$@" -) diff --git a/build-and-push-one.sh b/build-and-push-one.sh deleted file mode 100755 index 4a60ceb..0000000 --- a/build-and-push-one.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -# Copyright 2019-2021, The Khronos Group Inc. -# SPDX-License-Identifier: Apache-2.0 - -# Pass a dockerfile name. -# The tag portion of the name is used as the tag within the repo. -# Name format can be either tag.dockerfile or Dockerfile.tag - -set -e - -REPO="khronosgroup/docker-images" - -( - cd $(dirname $0) - DOCKERFILE=$1 - shift - TAG=${DOCKERFILE#Dockerfile.} - TAG=${TAG%.dockerfile} - if [ "$TAG" == "Dockerfile" ]; then - TAG=latest - fi - docker build "$@" . -f "$DOCKERFILE" -t "$REPO:$TAG" - docker push "$REPO:$TAG" -) diff --git a/build-and-push-openxr.sh b/build-and-push-openxr.sh deleted file mode 100755 index a1632e5..0000000 --- a/build-and-push-openxr.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -# Copyright 2019-2021, The Khronos Group Inc. -# SPDX-License-Identifier: Apache-2.0 -set -e - -./build-and-push-one.sh Dockerfile.openxr-base.* -./build-and-push-one.sh Dockerfile.openxr.* -./build-and-push-one.sh Dockerfile.openxr-sdk.* -./build-and-push-one.sh Dockerfile.openxr-pregenerated-sdk.* diff --git a/build-one.sh b/build-one.sh index 8b39cec..9eb6a32 100755 --- a/build-one.sh +++ b/build-one.sh @@ -2,9 +2,13 @@ # Copyright 2019-2021, The Khronos Group Inc. # SPDX-License-Identifier: Apache-2.0 -# Pass a dockerfile name. +# Pass a Dockerfile name and version (typically the year and month). +# Optionally pass the literal text "push" as third argument to publish +# the result to dockerhub. +# Any extra arguments (including the third argument if it's not "push") +# are passed to `docker build` literally. +# # The tag portion of the name is used as the tag within the repo. -# Name format can be either tag.dockerfile or Dockerfile.tag set -e @@ -13,8 +17,18 @@ REPO="khronosgroup/docker-images" ( cd $(dirname $0) DOCKERFILE=$1 - shift - TAG=${DOCKERFILE#Dockerfile.} - TAG=${TAG%.dockerfile} - docker build "$@" . -f "$DOCKERFILE" -t "$REPO:$TAG" + VERSION=$2 + shift 2 + if [ "$1" == "push" ]; then + OP=$1 + shift + fi + docker build "$@" . -f "$DOCKERFILE.Dockerfile" \ + --build-arg "VERSION=$VERSION" \ + -t "$REPO:$DOCKERFILE.latest" \ + -t "$REPO:$DOCKERFILE.$VERSION" + if [ "$OP" == "push" ]; then + docker push "$REPO:$DOCKERFILE.latest" + docker push "$REPO:$DOCKERFILE.$VERSION" + fi ) diff --git a/Dockerfile.openxr-base.202110 b/openxr-base.Dockerfile similarity index 100% rename from Dockerfile.openxr-base.202110 rename to openxr-base.Dockerfile diff --git a/Dockerfile.openxr-pregenerated-sdk.202201 b/openxr-pregenerated-sdk.Dockerfile similarity index 100% rename from Dockerfile.openxr-pregenerated-sdk.202201 rename to openxr-pregenerated-sdk.Dockerfile diff --git a/Dockerfile.openxr-sdk.202110 b/openxr-sdk.Dockerfile similarity index 100% rename from Dockerfile.openxr-sdk.202110 rename to openxr-sdk.Dockerfile diff --git a/Dockerfile.openxr.202110 b/openxr.Dockerfile similarity index 93% rename from Dockerfile.openxr.202110 rename to openxr.Dockerfile index 156dda9..087b21a 100644 --- a/Dockerfile.openxr.202110 +++ b/openxr.Dockerfile @@ -16,7 +16,9 @@ # This is a Docker container for (interactive) OpenXR specification builds -FROM khronosgroup/docker-images:openxr-base.202110 +ARG VERSION + +FROM khronosgroup/docker-images:openxr-base.$VERSION LABEL maintainer="Ryan Pavlik " # Add the entrypoint to the image diff --git a/vulkan-docs-base.dockerfile b/vulkan-docs-base.Dockerfile similarity index 100% rename from vulkan-docs-base.dockerfile rename to vulkan-docs-base.Dockerfile diff --git a/vulkan-docs.dockerfile b/vulkan-docs.Dockerfile similarity index 100% rename from vulkan-docs.dockerfile rename to vulkan-docs.Dockerfile