Skip to content

[Create] FishTravle.html #33

[Create] FishTravle.html

[Create] FishTravle.html #33

Workflow file for this run

name: Build Test
on:
push:
branches:
- main
jobs:
publish:
runs-on: ubuntu-latest
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
run: |
cd ./game-server
./gradlew build
- name: Docker Login
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker Build and Push
uses: docker/build-push-action@v2
with:
context: ./game-server
file: game-server/Dockerfile
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/${{ secrets.REPOSITORY_NAME }}
- name: Publish in EC2
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ubuntu
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.REPOSITORY_NAME }}:latest
sudo docker stop ${{ secrets.REPOSITORY_NAME }} || true
sudo docker rm ${{ secrets.REPOSITORY_NAME }} || true
sudo docker run -d --name ${{ secrets.REPOSITORY_NAME }} -p 8000:8000 ${{ secrets.DOCKER_USERNAME }}/${{ secrets.REPOSITORY_NAME }}:latest