Skip to content

Upload SIG Build docker containers regularly #54

Upload SIG Build docker containers regularly

Upload SIG Build docker containers regularly #54

# Copyright 2022 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
name: Upload SIG Build docker containers regularly
on:
workflow_dispatch:
schedule:
# Run once a week on Sunday at midnight. See http://crontab.guru
- cron: '0 0 * * 0'
push:
paths:
- '.github/workflows/sigbuild-docker.yml'
- 'tensorflow/tools/tf_sig_build_dockerfiles/**'
- '!tensorflow/tools/tf_sig_build_dockerfiles/README.md'
branches:
- master
jobs:
docker:
if: github.repository == 'tensorflow/tensorflow' # Don't do this in forks
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [python3.7, python3.8, python3.9, python3.10]
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to GCR
uses: docker/login-action@v1
with:
registry: gcr.io
username: _json_key
password: ${{ secrets.GCP_CREDS }}
-
name: Grab the upcoming TF version to tag this container
run: |
# [[:digit:]] searches for numbers and \+ joins them together
major_version=$(grep "^#define TF_MAJOR_VERSION" ./tensorflow/core/public/version.h | grep -o "[[:digit:]]\+")
minor_version=$(grep "^#define TF_MINOR_VERSION" ./tensorflow/core/public/version.h | grep -o "[[:digit:]]\+")
echo ::set-output name=TF_VERSION::${major_version}.${minor_version}
# Also get the current date to do cache busting. Assumes one day
# is an ok range for rebuilds
echo "::set-output name=DATE::$(date +'%Y-%m-%d')"
id: tf-version
-
name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
context: ./tensorflow/tools/tf_sig_build_dockerfiles
target: devel
build-args: |
PYTHON_VERSION=${{ matrix.python-version }}
CACHEBUSTER=${{ steps.tf-version.outputs.DATE }}
tags: |
tensorflow/build:latest-${{ matrix.python-version }}
tensorflow/build:${{ steps.tf-version.outputs.TF_VERSION }}-${{ matrix.python-version }}
gcr.io/tensorflow-sigs/build:latest-${{ matrix.python-version }}
gcr.io/tensorflow-sigs/build:${{ steps.tf-version.outputs.TF_VERSION }}-${{ matrix.python-version }}
cache-from: type=registry,ref=tensorflow/build:latest-${{ matrix.python-version }}
cache-to: type=inline
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}