No description
Find a file
Wylie Conlon 23130a485b
docs: Fix examples in README (#10)
Since the example uses `steps.extract.outputs`, it needs to assign `id: extract` to the step first.
2021-10-19 22:02:11 +01:00
.github 🚥 Test cross-platform support via Workflows (#6) 2020-11-15 22:34:27 +00:00
dist Extract path from Docker Image (#1) 2020-08-29 16:20:01 +01:00
src 🐛 Extract contents of directory (#4) 2020-09-06 18:47:06 +01:00
.editorconfig Extract path from Docker Image (#1) 2020-08-29 16:20:01 +01:00
.eslintrc.json Extract path from Docker Image (#1) 2020-08-29 16:20:01 +01:00
.gitignore Extract path from Docker Image (#1) 2020-08-29 16:20:01 +01:00
action.yml Extract path from Docker Image (#1) 2020-08-29 16:20:01 +01:00
LICENSE Extract path from Docker Image (#1) 2020-08-29 16:20:01 +01:00
package-lock.json 🐛 Remove creation of extract destination (#3) 2020-09-06 15:57:37 +01:00
package.json 🐛 Remove creation of extract destination (#3) 2020-09-06 15:57:37 +01:00
README.md docs: Fix examples in README (#10) 2021-10-19 22:02:11 +01:00

Docker Extract

A GitHub Action for extracting files from a Docker Image.

- uses: shrink/actions-docker-extract@v1
  with:
    image: 'ghost:alpine'
    path: '/var/lib/ghost/current/core/built/assets/.'

Inputs

All inputs are required.

ID Description Examples
image Docker Image to extract files from alpine ghcr.io/github/super-linter:latest
path Path (from root) to a file or directory within Image files/example.txt files files/.

📎 To copy the contents of a directory the path must end with /. otherwise the directory itself will be copied. More information about the specific rules can be found via the docker cp documentation.

Outputs

ID Description Example
destination Destination path containing the extracted file(s) .extracted-1598717412/

Examples

Build, Extract

Using docker/build-push-action to build a Docker Image and then extract the contents of the /app directory within the newly built image to upload as a dist artifact.

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Build Docker Image
        uses: docker/build-push-action@v1
        with:
          repository: my-example-image
          tags: latest
      - uses: shrink/actions-docker-extract@v1
        id: extract
        with:
          image: my-example-image
          path: /app/.
      - name: Upload Dist
        uses: actions/upload-artifact@v2
        with:
          path: ${{ steps.extract.outputs.destination }}
          name: dist

Login, Pull, Extract

Using docker/login-action to authenticate with the GitHub Container Registry to extract from a published Docker Image.

jobs:
  extract:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Login to GitHub Container Registry
        uses: docker/login-action@v1
        with:
          registry: ghcr.io
          username: ${{ github.repository_owner }}
          password: ${{ secrets.GHCR_PAT }}
      - uses: shrink/actions-docker-extract@v1
        id: extract
        with:
          image: ghcr.io/${{ github.repository }}:latest
          path: /app/.
      - name: Upload Dist
        uses: actions/upload-artifact@v2
        with:
          path: ${{ steps.extract.outputs.destination }}
          name: dist