Skip to content

Commit 96aa35b

Browse files
committed
Add Docker image to GitHub Container Registry
Related to AykutSarac#434 Add a prebuilt Docker image of JSON Crack to GitHub Container Registry. * **README.md** - Add instructions for using the prebuilt Docker image. - Mention the GitHub Container Registry as the source. * **.github/workflows/docker-image.yml** - Create a new GitHub Actions workflow file. - Add steps to build Docker image. - Add steps to push Docker image to GitHub Container Registry.
1 parent 2a676c1 commit 96aa35b

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

.github/workflows/docker-image.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v2
18+
19+
- name: Set up Docker Buildx
20+
uses: docker/setup-buildx-action@v1
21+
22+
- name: Cache Docker layers
23+
uses: actions/cache@v2
24+
with:
25+
path: /tmp/.buildx-cache
26+
key: ${{ runner.os }}-buildx-${{ github.sha }}
27+
restore-keys: |
28+
${{ runner.os }}-buildx-
29+
30+
- name: Log in to GitHub Container Registry
31+
uses: docker/login-action@v1
32+
with:
33+
registry: ghcr.io
34+
username: ${{ github.actor }}
35+
password: ${{ secrets.GITHUB_TOKEN }}
36+
37+
- name: Build and push Docker image
38+
uses: docker/build-push-action@v2
39+
with:
40+
context: .
41+
push: true
42+
tags: ghcr.io/aykutsarac/jsoncrack:latest
43+
cache-from: type=local,src=/tmp/.buildx-cache
44+
cache-to: type=local,dest=/tmp/.buildx-cache

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,20 @@ docker compose up
127127
# Go to http://localhost:8888
128128
```
129129

130+
### Prebuilt Docker Image
131+
132+
A prebuilt Docker image of JSON Crack is available on GitHub Container Registry. You can pull and run the image using the following commands:
133+
134+
```console
135+
# Pull the prebuilt Docker image
136+
docker pull ghcr.io/aykutsarac/jsoncrack:latest
137+
138+
# Run the Docker container
139+
docker run -p 8888:8080 ghcr.io/aykutsarac/jsoncrack:latest
140+
141+
# Go to http://localhost:8888
142+
```
143+
130144
<!-- LICENSE -->
131145

132146
## License

0 commit comments

Comments
 (0)