File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Build Docker Container
2+
3+ on :
4+ push :
5+ branches : [ main, master ]
6+ pull_request :
7+ branches : [ main, master ]
8+ workflow_dispatch :
9+
10+ jobs :
11+ build :
12+ runs-on : ubuntu-latest
13+
14+ steps :
15+ - name : Checkout code
16+ uses : actions/checkout@v4
17+
18+ - name : Set up Docker Buildx
19+ uses : docker/setup-buildx-action@v3
20+
21+ - name : Build Docker image
22+ uses : docker/build-push-action@v5
23+ with :
24+ context : .
25+ push : false
26+ tags : java-profiler-tools:latest
27+ cache-from : type=gha
28+ cache-to : type=gha,mode=max
29+
30+ - name : Test Docker image
31+ run : |
32+ docker run --rm java-profiler-tools:latest java -version
33+ docker run --rm java-profiler-tools:latest ls -la /usr/local/async-profiler/
34+ docker run --rm java-profiler-tools:latest ls -la /usr/local/flame-graph/
Original file line number Diff line number Diff line change 1+ name : Publish Docker Image
2+
3+ on :
4+ push :
5+ branches : [ main, master ]
6+ tags : [ 'v*' ]
7+ workflow_dispatch :
8+
9+ jobs :
10+ publish :
11+ runs-on : ubuntu-latest
12+ if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
13+
14+ steps :
15+ - name : Checkout code
16+ uses : actions/checkout@v4
17+
18+ - name : Set up Docker Buildx
19+ uses : docker/setup-buildx-action@v3
20+
21+ - name : Log in to Docker Hub
22+ uses : docker/login-action@v3
23+ with :
24+ username : ${{ secrets.DOCKER_USERNAME }}
25+ password : ${{ secrets.DOCKER_PASSWORD }}
26+
27+ - name : Extract metadata
28+ id : meta
29+ uses : docker/metadata-action@v5
30+ with :
31+ images : ${{ secrets.DOCKER_USERNAME }}/java-profiler-tools
32+ tags : |
33+ type=ref,event=branch
34+ type=ref,event=pr
35+ type=semver,pattern={{version}}
36+ type=semver,pattern={{major}}.{{minor}}
37+ type=sha
38+
39+ - name : Build and push Docker image
40+ uses : docker/build-push-action@v5
41+ with :
42+ context : .
43+ push : true
44+ tags : ${{ steps.meta.outputs.tags }}
45+ labels : ${{ steps.meta.outputs.labels }}
46+ cache-from : type=gha
47+ cache-to : type=gha,mode=max
Original file line number Diff line number Diff line change @@ -8,3 +8,31 @@ This container can be handy when you need to attach to some Java container and
88
99Usage example can be found [ here] ( https://ember.deltixlab.com/docs/kb/profiling/?_highlight=perf#profiling-ember-with-perf ) .
1010
11+ ## CI/CD
12+
13+ This project uses GitHub Actions for continuous integration and deployment:
14+
15+ ### Build Workflow
16+ - ** File** : ` .github/workflows/docker-build.yml `
17+ - ** Triggers** : Push to main/master branch, pull requests, manual dispatch
18+ - ** Actions** : Builds the Docker image and runs basic tests
19+ - ** No external dependencies required**
20+
21+ ### Publish Workflow (Optional)
22+ - ** File** : ` .github/workflows/docker-publish.yml `
23+ - ** Triggers** : Push tags starting with 'v' (e.g., v1.0.0), manual dispatch
24+ - ** Actions** : Builds and publishes the Docker image to Docker Hub
25+ - ** Required secrets** : ` DOCKER_USERNAME ` and ` DOCKER_PASSWORD `
26+
27+ ### Setting up Docker Hub Publishing
28+ If you want to publish to Docker Hub, add these secrets to your GitHub repository:
29+ 1 . Go to your repository Settings → Secrets and variables → Actions
30+ 2 . Add ` DOCKER_USERNAME ` with your Docker Hub username
31+ 3 . Add ` DOCKER_PASSWORD ` with your Docker Hub access token
32+
33+ Then create a tag to trigger the publish workflow:
34+ ``` bash
35+ git tag v1.0.0
36+ git push origin v1.0.0
37+ ```
38+
You can’t perform that action at this time.
0 commit comments