add workflow for building a docker image #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build docker image | |
on: | |
workflow_dispatch: | |
pull_request: | |
paths: | |
- .github/workflows/build-docker-image.yml | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
env: | |
VERILATOR_VERSION: v5.024 | |
VERILATOR_UVM_VERSION: 7ca2d6470a | |
OPENOCD_VERSION: riscv-nohalt-rebase | |
RENODE_VERSION: 1.15.3+20240924gitc7bc336bb | |
SPIKE_VERSION: d70ea67d | |
DEBIAN_FRONTEND: "noninteractive" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create directory for context | |
run: | | |
# Work in an empty directory to avoid unnecessary copying. | |
mkdir context | |
- name: Get current date | |
id: date | |
run: echo "timestamp=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT | |
- name: Build and push to registry | |
uses: docker/build-push-action@v6 | |
with: | |
context: context | |
push: true | |
tags: ghcr.io/antmicro/cores-veer-el2:${{ steps.date.outputs.timestamp }} | |
file: .github/Dockerfile | |
build-args: | | |
VERILATOR_VERSION=${{ env.VERILATOR_VERSION }} | |
VERILATOR_UVM_VERSION=${{ env.VERILATOR_UVM_VERSION }} | |
OPENOCD_VERSION=${{ env.OPENOCD_VERSION }} | |
RENODE_VERSION=${{ env.RENODE_VERSION }} | |
SPIKE_VERSION=${{ env.SPIKE_VERSION }} |