From 55b498d19030b63f107b4a20ecbb2adf6b6f59e0 Mon Sep 17 00:00:00 2001 From: Illia Vysochyn Date: Mon, 1 Jul 2024 13:29:51 +0200 Subject: [PATCH] [#61664] codespace: Dockerfile-lxqt: Update base image Updates the base image for the `lxqt` to use latest ORFS from docker registries. Replaces manual docker build invocation with appropriate action in the workflow. Signed-off-by: Illia Vysochyn --- .../ubuntu-gui-full/devcontainer.json | 2 +- .../github-actions-publish-docker-images.yml | 82 ++++++++----------- tools/codespace/Dockerfile-lxqt | 2 +- tools/codespace/Dockerfile-orfs | 13 --- tools/codespace/README.md | 6 +- tools/codespace/scripts/install-orfs.sh | 39 --------- 6 files changed, 40 insertions(+), 104 deletions(-) delete mode 100644 tools/codespace/Dockerfile-orfs delete mode 100644 tools/codespace/scripts/install-orfs.sh diff --git a/.devcontainer/ubuntu-gui-full/devcontainer.json b/.devcontainer/ubuntu-gui-full/devcontainer.json index 21541a3f6b..ab6aa98e05 100644 --- a/.devcontainer/ubuntu-gui-full/devcontainer.json +++ b/.devcontainer/ubuntu-gui-full/devcontainer.json @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 { - "image": "ghcr.io/antmicro/openroad-flow-scripts:lxqt", + "image": "ghcr.io/the-openroad-project/openroad-flow-scripts:lxqt", "forwardPorts": [6080], "portsAttributes": { "6080": { diff --git a/.github/workflows/github-actions-publish-docker-images.yml b/.github/workflows/github-actions-publish-docker-images.yml index 3b857e5f2a..bf32946e50 100644 --- a/.github/workflows/github-actions-publish-docker-images.yml +++ b/.github/workflows/github-actions-publish-docker-images.yml @@ -10,6 +10,8 @@ on: - flow/Makefile - docker/Dockerfile.dev - docker/Dockerfile.builder + - tools/codespace/scripts/** + - tools/codespace/Dockerfile-lxqt pull_request: paths: - etc/DependencyInstaller.sh @@ -20,6 +22,8 @@ on: - flow/Makefile - docker/Dockerfile.dev - docker/Dockerfile.builder + - tools/codespace/scripts/** + - tools/codespace/Dockerfile-lxqt jobs: buildCodespaceImage: @@ -28,29 +32,29 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Set environment variables + run: echo "IMAGE=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $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' && github.repository == 'antmicro/openroad-flow-scripts' + if: github.event_name != 'pull_request' uses: docker/login-action@v3 with: registry: ghcr.io username: gha password: ${{ github.token }} - - name: Build ORFS - run: | - docker build -t ghcr.io/antmicro/openroad-flow-scripts:orfs -f tools/codespace/Dockerfile-orfs . - - - name: Push container image to GitHub Container Registry (GHCR) - if: github.event_name != 'pull_request' && github.repository == 'antmicro/openroad-flow-scripts' - run: docker push ghcr.io/antmicro/openroad-flow-scripts:orfs - - - name: Build LXQt - run: | - docker build -t ghcr.io/antmicro/openroad-flow-scripts:lxqt -f tools/codespace/Dockerfile-lxqt . - - - name: Push container image to GitHub Container Registry (GHCR) - if: github.event_name != 'pull_request' && github.repository == 'antmicro/openroad-flow-scripts' - run: docker push ghcr.io/antmicro/openroad-flow-scripts:lxqt + - name: Build and export codespaces image + uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: ${{ env.IMAGE }}:lxqt + file: tools/codespace/Dockerfile-lxqt + cache-from: type=registry,ref=${{ env.IMAGE }}:lxqtbuildcache + cache-to: type=registry,ref=${{ env.IMAGE }}:lxqtbuildcache buildDependenciesImage: strategy: @@ -60,7 +64,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out repository code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 1 submodules: recursive @@ -92,7 +96,6 @@ jobs: file: docker/Dockerfile.dev build-args: | fromImage=${{ matrix.os[1] }} - numThreads=$(nproc) cache-from: type=registry,ref=${{ env.IMAGE_DEPS }}:buildcache cache-to: type=registry,ref=${{ env.IMAGE_DEPS }}:buildcache,mode=max @@ -110,7 +113,7 @@ jobs: tool-cache: false - name: Check out repository code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 1 submodules: recursive @@ -119,27 +122,11 @@ jobs: run: | echo "IMAGE=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')/${{ matrix.os }}" >> $GITHUB_ENV echo "IMAGE_DEPS=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')-dev/${{ matrix.os }}" >> $GITHUB_ENV + echo "NUM_THREADS=$(nproc)" >> $GITHUB_ENV - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - # We don't use the build-push-action here because it hangs - - name: Build ORFS image - run: | - docker buildx build \ - --load \ - --build-arg fromImage=${{ env.IMAGE_DEPS }}:latest \ - --build-arg numThreads=$(nproc) \ - --cache-from type=registry,ref=${{ env.IMAGE }}:buildcache \ - --tag ${{ env.IMAGE }}:latest \ - --file docker/Dockerfile.builder \ - . - - - name: Test build - run: | - cmd="source ./env.sh && yosys -help && openroad -help && make -C flow ;" - docker run ${{ env.IMAGE }}:latest /bin/bash -c "${cmd}" - - name: Login to GitHub Container Registry (GHCR) if: github.event_name != 'pull_request' uses: docker/login-action@v2 @@ -148,14 +135,15 @@ jobs: username: gha password: ${{ github.token }} - - name: Export ORFS image - run: | - docker buildx build \ - --build-arg fromImage=${{ env.IMAGE_DEPS }}:latest \ - --build-arg numThreads=$(nproc) \ - --cache-from type=registry,ref=${{ env.IMAGE }}:buildcache \ - --cache-to type=registry,ref=${{ env.IMAGE }}:buildcache,mode=max \ - --tag ${{ env.IMAGE }}:latest \ - --file docker/Dockerfile.builder \ - --push \ - . + - 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 diff --git a/tools/codespace/Dockerfile-lxqt b/tools/codespace/Dockerfile-lxqt index eba65f4095..370ff41ce0 100644 --- a/tools/codespace/Dockerfile-lxqt +++ b/tools/codespace/Dockerfile-lxqt @@ -1,7 +1,7 @@ # Copyright (c) 2024 Antmicro # SPDX-License-Identifier: Apache-2.0 -FROM ghcr.io/antmicro/openroad-flow-scripts:orfs +FROM openroad/orfs:latest COPY ./tools/codespace/scripts/common.sh /usr/local/bin/common.sh COPY ./tools/codespace/scripts/install-desktop-deps.sh /usr/local/bin/install-desktop-deps.sh diff --git a/tools/codespace/Dockerfile-orfs b/tools/codespace/Dockerfile-orfs deleted file mode 100644 index a05ff667b8..0000000000 --- a/tools/codespace/Dockerfile-orfs +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (c) 2024 Antmicro -# SPDX-License-Identifier: Apache-2.0 - -FROM ubuntu:22.04 - -COPY ./tools/codespace/scripts/install-orfs.sh /usr/local/bin/install-orfs.sh -RUN bash /usr/local/bin/install-orfs.sh - -ENV PATH="$PATH:/usr/local/bin" - -ENV PATH="$PATH:/yosys/" -ENV OPENROAD_EXE=/usr/bin/openroad -ENV YOSYS_CMD=/yosys/yosys diff --git a/tools/codespace/README.md b/tools/codespace/README.md index fa063f60e7..69ae44a6c5 100644 --- a/tools/codespace/README.md +++ b/tools/codespace/README.md @@ -20,15 +20,15 @@ First time Codespace users are encouraged to read the tutorial [creating a codes ### OpenROAD GUI -At the bottom, there should be tab `PORTS`, where you will find the `Forwarded Address`. A link labelled `Desktop (6080) is provided, which you can follow to open the OpenROAD GUI. +At the bottom, there should be tab `PORTS`, where you will find the `Forwarded Address`. A link labelled `Desktop (6080)` is provided, which you can follow to open the OpenROAD GUI. ![open](../../docs/images/open_vnc.gif) Test that the ORFS flow works by running the following commands: ``` -cd ~/OpenROAD-flow-scripts/flow -. ../env.sh +cd /OpenROAD-flow-scripts/flow +source ../env.sh make make gui_final ``` diff --git a/tools/codespace/scripts/install-orfs.sh b/tools/codespace/scripts/install-orfs.sh deleted file mode 100644 index 9f317de871..0000000000 --- a/tools/codespace/scripts/install-orfs.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash -# Copyright (c) 2024 Antmicro -# SPDX-License-Identifier: Apache-2.0 - -export DEBIAN_FRONTEND=noninteractive - -# Klayout -export KLAYOUT_VER=${KLAYOUT_VER:-0.28.17-1} -apt-get -qqy update -apt-get install -qqy --no-install-recommends git wget ca-certificates make time - -update-ca-certificates -wget https://www.klayout.org/downloads/Ubuntu-22/klayout_${KLAYOUT_VER}_amd64.deb -apt-get install -qqy --no-install-recommends ./klayout_${KLAYOUT_VER}_amd64.deb -rm -rf ./klayout_${KLAYOUT_VER}_amd64.deb - -# Yosys -apt-get install -y --no-install-recommends gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python2 python3 python-is-python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev - -git clone https://github.com/YosysHQ/yosys.git -cd yosys -mkdir build -make -f Makefile config-$CC -make -f Makefile -j12 -make -f install -rm -rf build -cd .. - -# OpenROAD binary -wget https://github.com/Precision-Innovations/OpenROAD/releases/download/2024-03-25/openroad_2.0_amd64-ubuntu22.04-2024-03-25.deb -apt-get install -qqy --no-install-recommends ./openroad_2.0_amd64-ubuntu22.04-2024-03-25.deb -rm -rf ./openroad_2.0_amd64-ubuntu22.04-2024-03-25.deb - -# OpenROAD flow scripts -cd ~ -git clone https://github.com/The-OpenROAD-Project/OpenROAD-flow-scripts.git - -apt-get clean -apt-get autoclean