Skip to content

Commit 448e420

Browse files
committed
docker ci
1 parent 71c4b53 commit 448e420

File tree

3 files changed

+59
-4
lines changed

3 files changed

+59
-4
lines changed

.github/workflows/docker-image.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
11
## 🌐 GitHub Pages
22
Visit 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
```
610
git clone git@github.com:SolitudePy/LinuxForensicsLearn.git
711
cd LinuxForensicsLearn
812
docker compose build
913
docker 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+
---

docker-compose.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
services:
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"

0 commit comments

Comments
 (0)