Skip to content

Deploy : Jwt refreshing cookie fix #45

Deploy : Jwt refreshing cookie fix

Deploy : Jwt refreshing cookie fix #45

Workflow file for this run

name: action
on:
push:
branches:
- deploy
jobs:
sync-to-gitlab:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v2
with:
fetch-depth: 0
path: authentication
- name: Configure Git
run: |
git config --global user.name "신창엽"
git config --global user.email "[email protected]"
- name: Install rsync
run: sudo apt-get install rsync
- name: Configure merge strategy for pull
run: git config --global pull.rebase false
- name: Sync to Gitlab
env:
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
run: |
git clone --branch authentication https://oauth2:[email protected]/s10-bigdata-recom-sub2/S10P22D204.git S10P22D204
mkdir -p S10P22D204/authentication
rsync -av --delete --exclude='.git/' --exclude='.github/' --exclude='./Dockerfile' --exclude='./docker-compose.yml' ./authentication/ S10P22D204/authentication/
cd S10P22D204
git add authentication/
git_status=$(git status --porcelain)
if [ ! -z "$git_status" ]; then
git commit -m "authentication server develop update"
git push origin authentication --force
else
echo "No changes to commit."
fi
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Push Docker image with tag
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/auth:v${{ github.run_number }}
- name: Push Docker image latest
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/auth
deploy:
needs: build-and-push
runs-on: ubuntu-latest
steps:
- name: Deploy to EC2
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
docker stop auth || true
docker rm auth || true
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/auth:v${{ github.run_number }}
docker run --name auth -d \
-p 8081:8081 \
--network=bridge \
--restart unless-stopped \
${{ secrets.DOCKERHUB_USERNAME }}/auth:v${{ github.run_number }}
docker container prune -f
docker images | grep '${{ secrets.DOCKERHUB_USERNAME }}/auth' | grep -v 'v${{ github.run_number }}' | awk '{print $3}' | xargs -r docker rmi