Force none/none when using base_image, updated Readme and test

This commit is contained in:
Umberto Raimondi
2022-12-23 12:57:17 +01:00
parent b346fda275
commit c75a65e09b
4 changed files with 15 additions and 5 deletions
+2 -2
View File
@@ -21,8 +21,8 @@ jobs:
distro: fedora_latest
- arch: armv7
distro: archarm_latest
- arch: x86_64
distro: ubuntu18.04
- arch: none
distro: none
base_image: ubuntu:18.04
steps:
+4
View File
@@ -0,0 +1,4 @@
FROM none
COPY ./run-on-arch-install.sh /root/run-on-arch-install.sh
RUN chmod +x /root/run-on-arch-install.sh && /root/run-on-arch-install.sh
+5 -3
View File
@@ -20,7 +20,7 @@ The action also accepts some optional input parameters:
* `dockerRunArgs`: Additional arguments to pass to `docker run`, such as volume mappings. See [`docker run` documentation](https://docs.docker.com/engine/reference/commandline/run).
* `setup`: Shell commands to execute on the host before running the container, such as creating directories for volume mappings.
* `install`: Shell commands to execute in the container as part of `docker build`, such as installing dependencies. This speeds up subsequent builds if `githubToken` is also used, but note that the image layer will be publicly available in your projects GitHub Package Registry, so make sure the resulting image does not have any secrets cached in logs or state.
* `base_image`: Specify a custom base image, such as **busybox** or your predefined base image. This will replace the **FROM** claus in the default Dockerfile on the fly. This is optional. Hint: with this option you are able to use all the available archs other than the ones showed in this page. See the [advanced example](./.github/workflows/advanced-example.yml) in this repo. For more detials, see [PR #103](https://github.com/uraimo/run-on-arch-action/pull/103#issuecomment-1363810049).
* `base_image`: Specify a custom base image, such as [busybox](https://hub.docker.com/_/busybox), `arch` and `distro` should be set to `none` in this case. This will allow you to chose direcly the image that will be used in the *FROM* clause of the internal docker container without needing to create a Dockerfile.arch.distro for a specific arch/distro pair. For more detials, see [PR #103](https://github.com/uraimo/run-on-arch-action/pull/103#issuecomment-1363810049).
### Basic example
@@ -71,7 +71,7 @@ jobs:
runs-on: ubuntu-18.04
name: Build on ${{ matrix.distro }} ${{ matrix.arch }}
# Run steps on a matrix of 3 arch/distro combinations
# Run steps on a matrix of 4 arch/distro combinations
strategy:
matrix:
include:
@@ -81,7 +81,9 @@ jobs:
distro: alpine_latest
- arch: s390x
distro: fedora_latest
- arch: none
distro: none
base_image: riscv64/busybox
steps:
- uses: actions/checkout@v3
- uses: uraimo/run-on-arch-action@v2
+4
View File
@@ -20,6 +20,10 @@ async function main() {
const distro = core.getInput('distro', { required: true });
const base_image = core.getInput('base_image', { required: false });
if((arch==='none' || distro==='none') && !base_image){
throw new Error(`run-on-arch: If arch and distro are not specified, base_image is required.`);
}
// If bad arch/distro passed, fail fast before installing all the qemu stuff
const dockerFile = path.join(
__dirname, '..', 'Dockerfiles', `Dockerfile.${arch}.${distro}`);