GitHub action to run steps using docker
...
steps:
- uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/[email protected]
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Build
uses: docker/build-push-action@v3
with:
context: .
load: true
push: false
tags: user/app:latest
- name: Run
uses: tj-actions/docker-run@v2
id: docker-run
with:
image: user/app:latest
options: --name test-app -d
args: sleep 10
- name: Copy from container to host
uses: tj-actions/docker-cp@v2
with:
container: ${{ steps.docker-run.outputs.container-id }}
source: test.txt
destination: test.txt
- name: Display contents of test.txt
run: cat test.txt
# Hello World
...
steps:
- uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/[email protected]
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Build
uses: docker/build-push-action@v3
with:
context: .
load: true
push: false
tags: user/app:latest
- name: Create test.txt
run: echo "Hello World" >> test.txt
- name: Run
uses: tj-actions/docker-run@v2
id: docker-run
with:
image: user/app:latest
options: --name test-app -d
args: sleep 10
- name: Copy from host to container
uses: tj-actions/docker-cp@v2
with:
container: ${{ steps.docker-run.outputs.container-id }}
source: test.txt
destination: test.txt
local: false
- name: Display contents of test.txt
run: docker exec ${{ steps.docker-run.outputs.container-id }} cat test.txt
INPUT | TYPE | REQUIRED | DEFAULT | DESCRIPTION |
---|---|---|---|---|
container | string | true | Container name | |
destination | string | true | Destination file or directory | |
local | string | false | "true" |
Copy from container to local (i.e container to host) |
options | string | false | Additional options passed to docker cp | |
source | string | true | Source file or directory |
- Free software: MIT license
If you feel generous and want to show some extra appreciation:
This package was created with Cookiecutter using cookiecutter-action
Report bugs at https://github.com/tj-actions/docker-cp/issues.
If you are reporting a bug, please include:
- Your operating system name and version.
- Any details about your workflow that might be helpful in troubleshooting.
- Detailed steps to reproduce the bug.