14 Commits
v2 ... v5

Author SHA1 Message Date
Brock Allen
84aec248fc fix: print tarball path before loading 2024-03-03 22:14:39 -08:00
Brock Allen
f325c05afe wip: testing tarball field 2024-02-02 17:27:24 -08:00
Brock Allen
7fff0e1b7b feat: support docker image tarballs 2024-02-02 17:13:04 -08:00
Abdud Dayan Adeeb
3e77f186b7 Merge pull request #18 from rlancer/main
Updated docs
2021-05-30 16:29:20 -04:00
Robert Lancer
e6b2dcfc59 Updated docs
Demonstrates the need to checkout in order to mount a volume
2021-05-30 14:48:01 -04:00
Abdud Dayan Adeeb
358af5c600 Merge pull request #17 from lextira/bugfix/remove-command-file
Remove temporary "semicolon_delimited_script"
2021-04-07 16:56:13 -04:00
Dominik Kohler
fe7c510b59 use bash "shell parameter expansion" 2021-04-07 14:41:21 +02:00
Abdud Dayan Adeeb
43383a67d7 docs: example with latest docker build action
Closes #13
2021-03-21 22:12:44 -04:00
Abdud Dayan Adeeb
a808c5419d docs: update to v3 2021-03-17 20:49:17 -04:00
Abdud Dayan Adeeb
3b7e5e2681 Update RELEASES.md 2021-03-17 13:00:15 -04:00
Abdud Dayan Adeeb
4f65fabd24 Merge pull request #12 from rossettistone/docker-upgrade
Upgrade to more recent image of Docker
2021-03-17 10:43:43 -04:00
Mark Rossetti
7485e8fe25 Upgrade to more recent image of Docker 2021-03-16 10:40:17 -04:00
Abdud Dayan Adeeb
29813b1169 Merge pull request #8 from mdpye/patch-1
fix: typo in required field of action metadata
2021-03-03 18:01:38 -05:00
Mike Pye
3de7aa4662 fix: typo in required field of action metadata 2021-02-26 17:51:48 +00:00
5 changed files with 25 additions and 11 deletions

View File

@@ -1,4 +1,4 @@
FROM docker:19.03 FROM docker:20.10
RUN apk add bash RUN apk add bash

View File

@@ -4,10 +4,14 @@
- run an image built by a previous step. - run an image built by a previous step.
- See https://github.com/addnab/docker-run-action/blob/main/action.yml for all the available inputs. - See https://github.com/addnab/docker-run-action/blob/main/action.yml for all the available inputs.
## Examples
#### Typical Use Case #### Typical Use Case
```yaml ```yaml
- uses: addnab/docker-run-action@v2 - name: Checkout
uses: actions/checkout@v2 # Required to mount the Github Workspace to a volume
- uses: addnab/docker-run-action@v3
with: with:
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
@@ -21,7 +25,7 @@
#### run a privately-owned image #### run a privately-owned image
```yaml ```yaml
- uses: addnab/docker-run-action@v2 - uses: addnab/docker-run-action@v3
with: with:
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
@@ -32,11 +36,11 @@
#### run an image built by a previous step #### run an image built by a previous step
```yaml ```yaml
- uses: docker/build-push-action@v1 - uses: docker/build-push-action@v2
with: with:
repository: test-image tags: test-image:latest
push: false push: false
- uses: addnab/docker-run-action@v2 - uses: addnab/docker-run-action@v3
with: with:
image: test-image:latest image: test-image:latest
run: echo "hello world" run: echo "hello world"
@@ -46,7 +50,7 @@
#### use a specific shell (default: sh). #### use a specific shell (default: sh).
*Note: The shell must be installed in the container* *Note: The shell must be installed in the container*
```yaml ```yaml
- uses: addnab/docker-run-action@v2 - uses: addnab/docker-run-action@v3
with: with:
image: docker:latest image: docker:latest
shell: bash shell: bash

View File

@@ -1,5 +1,9 @@
# addnab/docker-run-action Releases # addnab/docker-run-action Releases
### 3.0.0
- Upgrade to docker 20.10 https://github.com/addnab/docker-run-action/pull/12
### 2.0.0 ### 2.0.0
- Added support for networking with other containers [#3](https://github.com/addnab/docker-run-action/pull/3) [#7](https://github.com/addnab/docker-run-action/pull/7) - Added support for networking with other containers [#3](https://github.com/addnab/docker-run-action/pull/3) [#7](https://github.com/addnab/docker-run-action/pull/7)

View File

@@ -2,6 +2,9 @@
name: 'Docker Run Action' name: 'Docker Run Action'
description: 'Run a command in a new container' description: 'Run a command in a new container'
inputs: inputs:
tarball:
description: 'Image tarball'
required: false
image: image:
description: 'Image' description: 'Image'
required: true required: true
@@ -27,7 +30,7 @@ inputs:
docker_network: docker_network:
description: 'Docker Network ID' description: 'Docker Network ID'
default: ${{ job.container.network }} default: ${{ job.container.network }}
retuired: false required: false
runs: runs:
using: 'docker' using: 'docker'
image: 'Dockerfile' image: 'Dockerfile'

View File

@@ -4,10 +4,13 @@ if [ ! -z $INPUT_USERNAME ];
then echo $INPUT_PASSWORD | docker login $INPUT_REGISTRY -u $INPUT_USERNAME --password-stdin then echo $INPUT_PASSWORD | docker login $INPUT_REGISTRY -u $INPUT_USERNAME --password-stdin
fi fi
echo "$INPUT_RUN" | sed -e 's/\\n/;/g' > semicolon_delimited_script
if [ ! -z $INPUT_DOCKER_NETWORK ]; if [ ! -z $INPUT_DOCKER_NETWORK ];
then INPUT_OPTIONS="$INPUT_OPTIONS --network $INPUT_DOCKER_NETWORK" then INPUT_OPTIONS="$INPUT_OPTIONS --network $INPUT_DOCKER_NETWORK"
fi fi
exec docker run -v "/var/run/docker.sock":"/var/run/docker.sock" $INPUT_OPTIONS --entrypoint=$INPUT_SHELL $INPUT_IMAGE -c "`cat semicolon_delimited_script`" if [ ! -z $INPUT_TARBALL ];
then echo "loading image from $INPUT_TARBALL"
docker load --input $INPUT_TARBALL
fi
exec docker run -v "/var/run/docker.sock":"/var/run/docker.sock" $INPUT_OPTIONS --entrypoint=$INPUT_SHELL $INPUT_IMAGE -c "${INPUT_RUN//$'\n'/;}"