Skip to content

Ruby - Build and push image #14

Ruby - Build and push image

Ruby - Build and push image #14

Workflow file for this run

name: Ruby - Build and push image
on:
push:
branches:
- master
pull_request:
types: [synchronize, opened]
schedule:
- cron: '54 07 12 * *' # on 12th day of every month at 07:54
jobs:
build-push:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
# 3.3.0 on Debian Stretch
- folder: "3.3/stretch"
tag: alboom/ruby-k8s-production:3.3-stretch
aliases: |
alboom/ruby-k8s-production:latest
# 3.2.2 on Debian Stretch
- folder: "3.2/stretch"
tag: alboom/ruby-k8s-production:3.2-stretch
# 3.1.4 on Debian Stretch
- folder: "3.1/stretch"
tag: alboom/ruby-k8s-production:3.1-stretch
# 3.0.6 on Debian Stretch
- folder: "3.0/stretch"
tag: alboom/ruby-k8s-production:3.0-stretch
# 2.7.8 on Debian Stretch
- folder: "2.7/stretch"
tag: alboom/ruby-k8s-production:2.7-stretch
# 2.6.10 on Debian Stretch
- folder: "2.6/stretch"
tag: alboom/ruby-k8s-production:2.6-stretch
# 2.5.9 on Debian Stretch
- folder: "2.5/stretch"
tag: alboom/ruby-k8s-production:2.5-stretch
# 2.4.10 on Debian Stretch
- folder: "2.4/stretch"
tag: alboom/ruby-k8s-production:2.4-stretch
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Set up image test
run: git clone --depth 1 https://github.com/docker-library/official-images.git ./tmp/official-images
-
name: Build and push Stretch
uses: docker/build-push-action@v2
with:
context: ./ruby/${{ matrix.folder }}
file: ./ruby/${{ matrix.folder }}/Dockerfile
builder: ${{ steps.buildx.outputs.name }}
pull: true
push: ${{ github.event_name != 'pull_request' }}
cache-from: type=registry,ref=${{ matrix.tag }}-buildcache
cache-to: type=registry,ref=${{ matrix.tag }}-buildcache,mode=max
tags: |
${{ matrix.tag }}
-
name: Running docker tests
run: |
docker pull ${{ matrix.tag }}
./tmp/official-images/test/run.sh "${{ matrix.tag }}"
./tmp/official-images/test/tests/ruby-binstubs/run.sh "${{ matrix.tag }}"
./tmp/official-images/test/tests/ruby-bundler/run.sh "${{ matrix.tag }}"
./tmp/official-images/test/tests/ruby-gems/run.sh "${{ matrix.tag }}"
./tmp/official-images/test/tests/ruby-hello-world/run.sh "${{ matrix.tag }}"
./tmp/official-images/test/tests/ruby-native-extension/run.sh "${{ matrix.tag }}"
./tmp/official-images/test/tests/ruby-nonroot/run.sh "${{ matrix.tag }}"
./tmp/official-images/test/tests/ruby-standard-libs/run.sh "${{ matrix.tag }}"
-
name: Build and push NodeJS Version
uses: docker/build-push-action@v2
with:
context: ./ruby/${{ matrix.folder }}/nodejs
file: ./ruby/${{ matrix.folder }}/nodejs/Dockerfile
builder: ${{ steps.buildx.outputs.name }}
pull: true
push: ${{ github.event_name != 'pull_request' }}
cache-from: type=registry,ref=${{ matrix.tag }}-with-nodejs-buildcache
cache-to: type=registry,ref=${{ matrix.tag }}-with-nodejs-buildcache,mode=max
tags: |
${{ matrix.tag }}-with-nodejs
-
name: Running docker tests
run: |
docker pull ${{ matrix.tag }}-with-nodejs
./tmp/official-images/test/run.sh "${{ matrix.tag }}-with-nodejs"
./tmp/official-images/test/tests/ruby-binstubs/run.sh "${{ matrix.tag }}-with-nodejs"
./tmp/official-images/test/tests/ruby-bundler/run.sh "${{ matrix.tag }}-with-nodejs"
./tmp/official-images/test/tests/ruby-gems/run.sh "${{ matrix.tag }}-with-nodejs"
./tmp/official-images/test/tests/ruby-hello-world/run.sh "${{ matrix.tag }}-with-nodejs"
./tmp/official-images/test/tests/ruby-native-extension/run.sh "${{ matrix.tag }}-with-nodejs"
./tmp/official-images/test/tests/ruby-nonroot/run.sh "${{ matrix.tag }}-with-nodejs"
./tmp/official-images/test/tests/ruby-standard-libs/run.sh "${{ matrix.tag }}-with-nodejs"
-
name: Build and push Full Version
uses: docker/build-push-action@v2
with:
context: ./ruby/${{ matrix.folder }}
file: ./ruby/${{ matrix.folder }}/Dockerfile
builder: ${{ steps.buildx.outputs.name }}
pull: true
push: ${{ github.event_name != 'pull_request' }}
cache-from: type=registry,ref=${{ matrix.tag }}-full-buildcache
cache-to: type=registry,ref=${{ matrix.tag }}-full-buildcache,mode=max
tags: |
${{ matrix.tag }}-full
${{ matrix.aliases }}
-
name: Running docker tests
run: |
docker pull ${{ matrix.tag }}-full
./tmp/official-images/test/run.sh "${{ matrix.tag }}-full"
./tmp/official-images/test/tests/ruby-binstubs/run.sh "${{ matrix.tag }}-full"
./tmp/official-images/test/tests/ruby-bundler/run.sh "${{ matrix.tag }}-full"
./tmp/official-images/test/tests/ruby-gems/run.sh "${{ matrix.tag }}-full"
./tmp/official-images/test/tests/ruby-hello-world/run.sh "${{ matrix.tag }}-full"
./tmp/official-images/test/tests/ruby-native-extension/run.sh "${{ matrix.tag }}-full"
./tmp/official-images/test/tests/ruby-nonroot/run.sh "${{ matrix.tag }}-full"
./tmp/official-images/test/tests/ruby-standard-libs/run.sh "${{ matrix.tag }}-full"