mirror of
https://github.com/addnab/docker-run-action.git
synced 2025-07-19 07:11:32 +03:00
Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
3e77f186b7 | |||
e6b2dcfc59 | |||
358af5c600 | |||
fe7c510b59 | |||
43383a67d7 | |||
a808c5419d | |||
3b7e5e2681 |
16
README.md
16
README.md
@ -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
|
||||||
|
@ -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)
|
||||||
|
@ -4,10 +4,8 @@ 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`"
|
exec docker run -v "/var/run/docker.sock":"/var/run/docker.sock" $INPUT_OPTIONS --entrypoint=$INPUT_SHELL $INPUT_IMAGE -c "${INPUT_RUN//$'\n'/;}"
|
||||||
|
Reference in New Issue
Block a user