Skip to content

[#62157] WIP: docker: Dockerfile.builder: Optimize dockerfile #83

[#62157] WIP: docker: Dockerfile.builder: Optimize dockerfile

[#62157] WIP: docker: Dockerfile.builder: Optimize dockerfile #83

name: Build and publish ORFS images
on:
push:
pull_request:
jobs:
buildDependenciesImage:
strategy:
fail-fast: false
matrix:
os: [["ubuntu20.04", "ubuntu:20.04"], ["ubuntu22.04", "ubuntu:22.04"]]
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: recursive
- name: Set environment variables
run: |
echo "IMAGE_DEPS=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')-test-cache-deps/${{ matrix.os[0] }}" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry (GHCR)
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: gha
password: ${{ github.token }}
- name: Copy OpenROAD installer
run: cp tools/OpenROAD/etc/DependencyInstaller.sh etc/InstallerOpenROAD.sh
- name: Build and export dependencies image
uses: docker/build-push-action@v6
with:
context: etc
push: true
tags: ${{ env.IMAGE_DEPS }}:latest
file: docker/Dockerfile.dev
build-args: |
fromImage=${{ matrix.os[1] }}
cache-from: type=registry,ref=${{ env.IMAGE_DEPS }}:buildcache
cache-to: type=registry,ref=${{ env.IMAGE_DEPS }}:buildcache,mode=max
buildORFSImage:
needs: buildDependenciesImage
strategy:
fail-fast: false
matrix:
os: ["ubuntu20.04", "ubuntu22.04"]
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: recursive
- name: Set environment variables
run: |
echo "IMAGE=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')-test-cache/${{ matrix.os }}" >> $GITHUB_ENV
echo "IMAGE_DEPS=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')-test-cache-deps/${{ matrix.os }}" >> $GITHUB_ENV
echo "NUM_THREADS=$(nproc)" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry (GHCR)
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: gha
password: ${{ github.token }}
- name: Build and export ORFS image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ env.IMAGE }}:latest
file: docker/Dockerfile.builder
build-args: |
fromImage=${{ env.IMAGE_DEPS }}
numThreads=${{ env.NUM_THREADS }}
cache-from: type=registry,ref=${{ env.IMAGE }}:buildcache
cache-to: type=registry,ref=${{ env.IMAGE }}:buildcache,mode=max