Skip to content

Build Docker image

Build Docker image #27

Workflow file for this run

name: Build Docker image
on:
workflow_dispatch:
repository_dispatch:
types: [build]
permissions:
contents: read
jobs:
build-group:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target:
- ruby-0.x-1.6
- ruby-1.8.6-1.8.7
- ruby-1.9
- ruby-2.0
- 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@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
- uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Build and push ${{ matrix.target }}
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
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@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
- uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Build and push ${{ matrix.target }}
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
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@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
- uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
with:
registry: ghcr.io
username: ${{ secrets.GHCR_USER }}
password: ${{ secrets.GHCR_ACCESS_TOKEN }}
- name: Build and push latest image
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
with:
context: .
file: Dockerfile.final
push: true
tags: |
docker.io/rubylang/all-ruby:latest
ghcr.io/ruby/all-ruby:latest