File tree Expand file tree Collapse file tree 3 files changed +59
-4
lines changed Expand file tree Collapse file tree 3 files changed +59
-4
lines changed Original file line number Diff line number Diff line change 1+ # GitHub Actions workflow for building and pushing Docker image to GitHub Container Registry
2+ name : Build and Push Docker image
3+
4+ on :
5+ push :
6+ branches : [ main ]
7+ pull_request :
8+ branches : [ main ]
9+
10+ jobs :
11+ build :
12+ runs-on : ubuntu-latest
13+ permissions :
14+ contents : read
15+ packages : write
16+
17+ steps :
18+ - name : Checkout repository
19+ uses : actions/checkout@v4
20+
21+ - name : Set up Docker Buildx
22+ uses : docker/setup-buildx-action@v3
23+
24+ - name : Log in to GitHub Container Registry
25+ uses : docker/login-action@v3
26+ with :
27+ registry : ghcr.io
28+ username : ${{ github.actor }}
29+ password : ${{ secrets.GITHUB_TOKEN }}
30+
31+ - name : Build and push Docker image
32+ uses : docker/build-push-action@v5
33+ with :
34+ context : .
35+ file : ./Dockerfile
36+ push : true
37+ tags : ghcr.io/${{ github.repository_owner }}/jekyll-modified:latest
Original file line number Diff line number Diff line change 11## 🌐 GitHub Pages
22Visit the live site: [ https://solitudepy.github.io/LinuxForensicsLearn ] ( https://solitudepy.github.io/LinuxForensicsLearn )
33
4- ## How to use offline
4+ ## 🐳 GitHub Container Registry (GHCR) Image
5+ A Docker image is automatically built and published to GitHub Container Registry (GHCR) on every push to the ` main ` branch.
6+
7+ ### Serving it yourself
8+ By default, ` docker-compose.yml ` can use the published image from GHCR:
59```
610git clone git@github.com:SolitudePy/LinuxForensicsLearn.git
711cd LinuxForensicsLearn
812docker compose build
913docker compose up -d
1014```
15+ This will pull the image from GHCR if you do not build locally.
16+
17+ ### Build Locally (Optional)
18+ If you want to build the image yourself (for local development or custom changes), you can use the ` build ` option in your ` docker-compose.yml ` :
19+
20+ ```
21+ services:
22+ jekyll-forensics:
23+ build:
24+ context: .
25+ dockerfile: Dockerfile
26+ # ...other options...
27+ ```
28+
29+ If both ` build ` and ` image ` are specified, Compose will build the image locally and use it instead of pulling from GHCR.
1130
31+ ---
Original file line number Diff line number Diff line change 11services :
22 jekyll-forensics :
3- build :
4- context : .
5- dockerfile : Dockerfile
3+ image : ghcr.io/solitudepy/jekyll-modified:latest
64 container_name : jekyll_forensics
75 ports :
86 - " 4000:4000"
You can’t perform that action at this time.
0 commit comments