forked from Azure/azure-osconfig
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
54 lines (47 loc) · 1.33 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Container run
description: Run a docker container
inputs:
registry:
description: Container registry.
required: false
default: ""
container:
description: The name of the container.
required: true
platform:
description: The container architecture.
required: true
mount:
description: The volume to mount.
required: true
tag:
description: The container tag.
required: false
default: latest
outputs:
id:
description: The container id of the running container.
value: ${{ steps.container.outputs.id }}
runs:
using: composite
steps:
- name: Setup QEMU
uses: docker/setup-qemu-action@v2
- name: Setup container
id: setup
run: |
if [ -n "${{ inputs.registry }}" ]; then
image=${{ inputs.registry }}/${{ inputs.container }}
else
image=${{ inputs.container }}
fi
echo container=$image >> $GITHUB_OUTPUT
shell: bash
- name: Run container
id: container
run: |
echo Running container ${{ steps.setup.outputs.container }}:${{ inputs.tag }}...
id=$(docker run -di --privileged -v ${{ inputs.mount }} --platform=${{ inputs.platform }} ${{ steps.setup.outputs.container }}:${{ inputs.tag }})
echo Container ID: $id
echo id=$id >> $GITHUB_OUTPUT
shell: bash