diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 00000000000..5bd09d03e15 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,44 @@ +name: Build and Push Docker Image + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Cache Docker layers + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: ghcr.io/aykutsarac/jsoncrack:latest + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache diff --git a/README.md b/README.md index 4bdbde4a3e2..96c309b8bab 100644 --- a/README.md +++ b/README.md @@ -127,6 +127,20 @@ docker compose up # Go to http://localhost:8888 ``` +### Prebuilt Docker Image + +A prebuilt Docker image of JSON Crack is available on GitHub Container Registry. You can pull and run the image using the following commands: + +```console +# Pull the prebuilt Docker image +docker pull ghcr.io/aykutsarac/jsoncrack:latest + +# Run the Docker container +docker run -p 8888:8080 ghcr.io/aykutsarac/jsoncrack:latest + +# Go to http://localhost:8888 +``` + ## License