how to run a command in host before entering docker container in github ci
If the running machine configuration is important for the build, try using self-hosted runner
.
- You can create VM in some of the cloud providers (ex. AWS, Azure, etc.) and register it with GitHub-CI.
- Install the GitHub-CI service
- Install all the utilities you need
- Register the runner to the repository
- Change the build script for
run-on
to point to the self-hoster runner
You can find more information in the GitHub-CI Docs
You could run only a step in the container instead of the whole job. Something like:
on: [push]jobs: update-aur: runs-on: ubuntu-latest steps: - run: sudo apt-get install ... - uses: docker://archlinux with: entrypoint: /usr/bin/bash args: -c 'pacman --noconfirm -Syu && pacman --noconfirm -S base-devel'
I don't know if it's practical in your case since you probably want to run a bunch of steps afterward in the same container. In any case you can find more info on the running steps in containers here and the different options available here