Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test worflow for image #90

Closed
wants to merge 12 commits into from
Closed
57 changes: 57 additions & 0 deletions .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Build and Push Docker Image (Testing)
on:
push:
branches: ['test-worflow-for-image']
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Set up Maven settings.xml
run: |
mkdir -p ~/.m2
echo "<settings>
<servers>
<server>
<id>github-webank</id>
<username>${{ github.actor }}</username>
<password>${{ secrets.WEBANK_ACCESS_TOKEN }}</password>
</server>
</servers>
</settings>" > ~/.m2/settings.xml

- name: Build JAR
run: mvn -f online-banking-app/pom.xml clean package -DskipTests

- name: Verify JAR File Exists
run: ls -l ./online-banking-app/target/online-banking-app-0.1-SNAPSHOT.jar

- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.WEBANK_ACCESS_TOKEN}}

- name: Build Docker image
run: |
docker build -t ghcr.io/adorsys-gis/webank-online-banking:latest .

- name: Push Docker image to GHCR
run: |
docker push ghcr.io/adorsys-gis/webank-online-banking:latest
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Run stage
FROM openjdk:17-jdk-slim

WORKDIR /webank-OnlineBanking

# py the JAR file from the online-banking-app module
COPY ./online-banking-app/target/online-banking-app-0.1-SNAPSHOT.jar /webank-OnlineBanking/online-banking-app-0.1-SNAPSHOT.jar

# Expose the port your app runs on
EXPOSE 8080

# Run the application
CMD ["java", "-jar", "/webank-OnlineBanking/online-banking-app-0.1-SNAPSHOT.jar"]
2 changes: 1 addition & 1 deletion online-banking-app/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ build/
!**/src/test/**/build/

### VS Code ###
.vscode/
.vscode/
2 changes: 2 additions & 0 deletions test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Testing workflow trigger
Testing workflow trigger
Loading