Skip to content

Commit

Permalink
added gh actions to submit docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
miguel-merlin committed Nov 21, 2024
1 parent c877fd0 commit 6f320b1
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build verification
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v3
- name: Setup Docker and docker-compose
run: |
sudo apt-get update
sudo apt-get install -y docker-compose
- name: Start postgres with docker-compose
run: docker-compose up -d
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
- name: Set up Maven
uses: stCarolas/setup-maven@v4
with:
maven-version: '3.8.6'
- name: Build with Maven
run: mvn clean install

dependency-submission:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
- name: Generate and submit dependecy graph
uses: advanced-security/maven-dependency-submission-action@v4
36 changes: 36 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build and publish Docker image
on:
push:
branches: ["main"]

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
- name: Set up Maven
uses: stCarolas/setup-maven@v4
with:
maven-version: '3.8.6'
- name: Build with maven
run: mvn clean package -DskipTests
- name: Login to Github container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: |
ghcr.io/stevensblueprint/orservice:${{ github.sha }}
ghcr.io/stevensblueprint/orservice:latest

0 comments on commit 6f320b1

Please sign in to comment.