Skip to content

Build Docker image

Build Docker image #8

Workflow file for this run

name: Build Docker image
on:
workflow_dispatch:
permissions:
contents: read
jobs:
build-group:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target:
- ruby-0.x-2.0
- ruby-1.2-1.8.7
- ruby-1.9
- ruby-2.1
- ruby-2.2
- ruby-2.3
- ruby-2.4
- ruby-2.5
- ruby-2.6
- ruby-2.7
- ruby-3.0
- ruby-3.1
- ruby-3.2
- ruby-3.3
- ruby-3.4
- ruby-3.5-4.0
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Build and push ${{ matrix.target }}
uses: docker/build-push-action@v6
with:
context: .
target: ${{ matrix.target }}
push: true
tags: docker.io/rubylang/all-ruby:${{ matrix.target }}
cache-from: |
type=registry,ref=docker.io/rubylang/all-ruby:cache-${{ matrix.target }}
cache-to: |
type=registry,ref=docker.io/rubylang/all-ruby:cache-${{ matrix.target }},mode=max
build-merge:
needs: build-group
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- target: ruby-0.x-2.4
tag: ruby-0.x-2.4
- target: ruby-2.5-3.1
tag: ruby-2.5-3.1
- target: ruby-3.2-4.0
tag: ruby-3.2-4.0
steps:
- name: Remove unnecessary files to release disk space
run: |
sudo rm -rf \
"$AGENT_TOOLSDIRECTORY" \
/opt/ghc \
/opt/google/chrome \
/opt/microsoft/msedge \
/opt/microsoft/powershell \
/opt/pipx \
/usr/lib/mono \
/usr/local/julia* \
/usr/local/lib/android \
/usr/local/lib/node_modules \
/usr/local/share/chromium \
/usr/local/share/powershell \
/usr/share/dotnet \
/usr/share/swift
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Build and push ${{ matrix.target }}
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.final
target: ${{ matrix.target }}
push: true
tags: docker.io/rubylang/all-ruby:${{ matrix.tag }}
build-latest:
needs: build-merge
runs-on: ubuntu-latest
steps:
- name: Remove unnecessary files to release disk space
run: |
sudo rm -rf \
"$AGENT_TOOLSDIRECTORY" \
/opt/ghc \
/opt/google/chrome \
/opt/microsoft/msedge \
/opt/microsoft/powershell \
/opt/pipx \
/usr/lib/mono \
/usr/local/julia* \
/usr/local/lib/android \
/usr/local/lib/node_modules \
/usr/local/share/chromium \
/usr/local/share/powershell \
/usr/share/dotnet \
/usr/share/swift
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.GHCR_USER }}
password: ${{ secrets.GHCR_ACCESS_TOKEN }}
- name: Build and push latest image
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.final
push: true
tags: |
docker.io/rubylang/all-ruby:latest
ghcr.io/ruby/all-ruby:latest