Skip to content

Commit

Permalink
github actions test
Browse files Browse the repository at this point in the history
  • Loading branch information
airoca committed Jan 22, 2024
1 parent 80bc97e commit e0438ff
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 30 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CICD

on:
push:
branches: [main]

jobs:
build:
runs-on: [ubuntu-latest]
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Build Project
run: mvn clean install -DskipTests
- name: Login to docker hub
run: docker login -u ${{secrets.DOCKER_USERNAME}} -p ${{secrets.DOCKER_PASSWORD}}
- name: Build docker image
run: docker build -t integrationninjas/springboot-example .
- name: Publish image to docker hub
run: docker push integrationninjas/springboot-example:latest

deploy:
needs: build
runs-on: [ip-172-31-8-60]
steps:
- name: Pull Image from docker hub
run: docker pull integrationninjas/springboot-example:latest
- name: Delete old container
run: docker rm -f springboot-example-container
- name: Run docker container
run: docker run -d -p 8080:8080 --name springboot-example-container integrationninjas/springboot-example
30 changes: 0 additions & 30 deletions .github/workflows/main.yml

This file was deleted.

5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM eclipse-temurin:17-jdk-alpine
WORKDIR /app
COPY target/springboot-example.jar springboot-example.jar
EXPOSE 8080
CMD ["java", "-jar", "springboot-example.jar"]

0 comments on commit e0438ff

Please sign in to comment.