Skip to content

Commit

Permalink
Merge pull request #14 from quarkslab/docker
Browse files Browse the repository at this point in the history
Add Docker workflow
  • Loading branch information
cnheitman authored Jul 15, 2024
2 parents 3ba6ff5 + 2d85650 commit 288326e
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 4 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Create and publish a Docker image

on:
release:
types: [published]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write
attestations: write
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
id: push
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
tags: ghcr.io/quarkslab/pastis:latest

- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,20 @@ The process is further [detailed in the documentation](https://quarkslab.github.
You can also run PASTIS using Docker:

```bash
docker pull ubuntu:22.04
docker build -t pastis-docker .
docker run -v <HOST-WORKSPACE>:/workspace --cap-add=SYS_PTRACE --user $(id -u $USER):$(id -g $USER) -it pastis-docker
# Pull from GitHub's registry.
docker pull ghcr.io/quarkslab/pastis:latest

# Or build the image.
docker build -t pastis .

# And run a container.
docker run -v <HOST-WORKSPACE>:/workspace --cap-add=SYS_PTRACE --user $(id -u $USER):$(id -g $USER) -it ghcr.io/quarkslab/pastis # or pastis if you buily the image locally.
```

To open another terminal to an already running container:

```bash
docker exec -it $(docker ps | grep 'pastis-docker' | awk '{print $1}') /bin/bash
docker exec -it $(docker ps | grep 'pastis' | awk '{print $1}') /bin/bash
```

The PASTIS Docker image has already installed all the needed dependencies such as AFL++ and Honggfuzz.
Expand Down

0 comments on commit 288326e

Please sign in to comment.