Merge pull request #195 from Team-MindWay/194-recommend-return #33
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build with Gradle and Run Docker Container | |
on: | |
push: | |
branches: ["develop"] | |
permissions: | |
contents: read | |
jobs: | |
build-and-run: | |
runs-on: self-hosted | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: "17" | |
distribution: "temurin" | |
- name: Build with Gradle | |
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 | |
with: | |
arguments: clean bootJar | |
- name: Run Whoami | |
run: whoami | |
- name: docker image build | |
run: sudo docker build -t mindway-v2-backend . | |
- name: docker stop container | |
run: | | |
for container in $(sudo docker ps -q); do | |
name=$(sudo docker inspect --format='{{.Name}}' $container) | |
if [ "$name" != "/dozzle" ]; then | |
sudo docker stop $container | |
fi | |
done | |
- name: docker run new container | |
run: sudo docker run --name mindwayv2container --env-file /home/minjun/.env --rm -d -p 10000:8080 mindway-v2-backend | |
- name: delete old docker image | |
run: sudo docker system prune -f --filter "label!=dozzle" |