Skip to content

Commit

Permalink
Add pipeline to dockerize and push
Browse files Browse the repository at this point in the history
  • Loading branch information
BanulaKumarage committed Apr 26, 2024
1 parent 9d02fae commit 001ef0a
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build and Push Docker Image

permissions:
contents: write
packages: write

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build-and-push:
runs-on: ubuntu-latest

env:
IMAGE_NAME: distributed-node
IMAGE_TAG: latest

steps:
- name: Set up Git repository
uses: actions/checkout@v2
with:
token: ${{ secrets.PAT }}

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

- name: Build Docker image and push to GitHub Container Registry
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
./mvnw clean compile jib:dockerBuild
docker tag distributed-file-server:0.0.1-SNAPSHOT ghcr.io/scatterrr-cse19/$IMAGE_NAME:$IMAGE_TAG
docker push ghcr.io/scatterrr-cse19/$IMAGE_NAME:$IMAGE_TAG
10 changes: 10 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>3.2.1</version>
<configuration>
<from>
<image>eclipse-temurin:17.0.4.1_1-jre</image>
</from>
</configuration>
</plugin>
</plugins>
</build>

Expand Down

0 comments on commit 001ef0a

Please sign in to comment.