Skip to content

Merge pull request #73 from Repick-official/develop #262

Merge pull request #73 from Repick-official/develop

Merge pull request #73 from Repick-official/develop #262

Workflow file for this run

name: Deploy Production Server
on:
push:
branches: [ "prod" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
## gradle build
- name: Build with Gradle
run: ./gradlew bootJar
## μ›Ή 이미지 λΉŒλ“œ 및 λ„μ»€ν—ˆλΈŒμ— push
- name: web docker build and push
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -t ${{ secrets.DOCKER_REPO }}/repick-web .
docker push ${{ secrets.DOCKER_REPO }}/repick-web
docker build -f dockerfile-nginx -t ${{ secrets.DOCKER_REPO }}/repick-nginx .
docker push ${{ secrets.DOCKER_REPO }}/repick-nginx
## docker compose up
- name: executing remote ssh commands using password
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ubuntu
key: ${{ secrets.KEY }}
script: |
cd /home/ubuntu/repick/
sudo touch .env
echo "${{ secrets.ENV_VARS }}" | sudo tee .env > /dev/null
sudo touch docker-compose.yaml
echo "${{ vars.DOCKER_COMPOSE }}" | sudo tee docker-compose.yaml > /dev/null
sudo chmod 666 /var/run/docker.sock
sudo docker rm -f $(docker ps -qa)
sudo docker pull ${{ secrets.DOCKER_REPO }}/repick-web
sudo docker pull ${{ secrets.DOCKER_REPO }}/repick-nginx
docker-compose -f docker-compose.yaml --env-file /home/ubuntu/repick/.env up -d
docker image prune -f