#203 fix: docker 시간 설정 변경 #110
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: deploy | |
on: | |
push: | |
branches: [ "develop" ] | |
jobs: | |
deploy: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Gradle Caching | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 17 | |
- name: Create Firebase json | |
id: create-json | |
uses: jsdaniell/[email protected] | |
with: | |
name: "firebase-service-key.json" | |
json: ${{ secrets.FIREBASE_KEY }} | |
dir: "src/main/resources" | |
- run: touch ./src/main/resources/application-secret.yaml | |
- run: echo "${{ secrets.DB_SECRET }}" > ./src/main/resources/application-secret.yaml | |
- run: cat ./src/main/resources/application-secret.yaml | |
- name: Grant execute permission for gradlew | |
run: chmod +x ./gradlew | |
shell: bash | |
- name: Build and no Test | |
run: ./gradlew build -x test | |
- name: Docker build & push to dev | |
run: | | |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | |
docker build -t ${{ secrets.DOCKER_USERNAME }}/psr-dev . | |
docker push ${{ secrets.DOCKER_USERNAME }}/psr-dev | |
- name: Deploy to dev | |
uses: appleboy/ssh-action@master | |
id: deploy-dev | |
with: | |
host: ${{ secrets.HOST_DEV }} # EC2 퍼블릭 IPv4 DNS | |
username: ${{ secrets.USERNAME }} # ubuntu | |
port: 22 | |
key: ${{ secrets.PRIVATE_KEY }} | |
script: | | |
sudo docker stop $(docker ps -a -q) | |
sudo docker rm $(docker ps -a -q) | |
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/psr-dev | |
sudo docker run -d -p 8080:8080 ${{ secrets.DOCKER_USERNAME }}/psr-dev | |
sudo docker image prune -f |