fix: 변경된 크롤링 시간 수정 #46
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: Prod PR merge | |
on: | |
push: | |
branches: [ "prod" ] | |
jobs: | |
prod-ci: | |
runs-on: ubuntu-22.04 | |
outputs: | |
image_tag: ${{ steps.get_image_tag.outputs.IMAGE_TAG }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.SUBMODULE_TOKEN }} | |
submodules: true | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: "17" | |
distribution: "corretto" | |
- name: Build with Gradle | |
run: ./gradlew build | |
- name: Setup Docker buildx | |
uses: docker/[email protected] | |
- name: Login to Docker Hub | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME_PROD }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN_PROD }} | |
- name: Get Image Tag | |
id: get_image_tag | |
run: | | |
IMAGE_TAG=$(git rev-parse --short HEAD) | |
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_OUTPUT | |
- name: Docker Image Build | |
run: docker build --platform linux/amd64 -t itracker2024/itracker-prod:${{ steps.get_image_tag.outputs.IMAGE_TAG }} -f Dockerfile-prod . | |
- name: Docker Hub Push | |
run: docker push itracker2024/itracker-prod:${{ steps.get_image_tag.outputs.IMAGE_TAG }} | |
prod-cd: | |
needs: prod-ci | |
runs-on: [self-hosted, Linux, prod] | |
steps: | |
- name: Pull Latest Docker Image | |
run: | | |
sudo docker login --username ${{ secrets.DOCKER_HUB_USERNAME_PROD }} --password ${{ secrets.DOCKER_HUB_ACCESS_TOKEN_PROD }} | |
sudo docker pull itracker2024/itracker-prod:${{ needs.prod-ci.outputs.image_tag }} | |
- name: Docker Compose | |
run: | | |
~/backend/zero-downtime-deploy.sh | |
docker container prune -f | |
sudo docker image prune -af |