feat: 카카오맵 데이터 구조 변경으로 인한 DB 리팩토링 (#54) #49
This file contains hidden or 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: Build and Push Docker Image | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| tags: [ 'v*' ] | |
| workflow_dispatch: | |
| inputs: | |
| image_tag: | |
| description: 'Docker image tag (leave empty for auto-generated tags)' | |
| required: false | |
| default: '' | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Free up disk space | |
| run: | | |
| echo "=== Before cleanup ===" | |
| df -h / | |
| echo "" | |
| echo "=== Removing unnecessary software ===" | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf /opt/ghc | |
| sudo rm -rf /usr/local/share/boost | |
| sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
| sudo apt-get clean | |
| echo "" | |
| echo "=== Cleaning Docker ===" | |
| docker system prune -af --volumes | |
| echo "" | |
| echo "=== After cleanup ===" | |
| df -h / | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Set tags | |
| id: tags | |
| run: | | |
| if [ "${{ github.event_name }}" == "workflow_dispatch" ] && [ -n "${{ github.event.inputs.image_tag }}" ]; then | |
| echo "type=raw,value=${{ github.event.inputs.image_tag }}" >> $GITHUB_OUTPUT.tags | |
| else | |
| { | |
| echo "type=ref,event=branch" | |
| echo "type=semver,pattern={{version}}" | |
| echo "type=semver,pattern={{major}}.{{minor}}" | |
| echo "type=raw,value=latest,enable={{is_default_branch}}" | |
| } >> $GITHUB_OUTPUT.tags | |
| fi | |
| echo "tags<<EOF" >> $GITHUB_OUTPUT | |
| cat $GITHUB_OUTPUT.tags >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| shell: bash | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ secrets.DOCKERHUB_USERNAME }}/yamyam-ops | |
| tags: ${{ steps.tags.outputs.tags }} | |
| - name: Check disk before build | |
| run: | | |
| echo "=== Disk before Docker build ===" | |
| df -h / | |
| - name: Build and push Docker image | |
| id: build | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./backend | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| build-args: | | |
| GITHUB_TOKEN=${{ secrets.ORG_GITHUB_TOKEN }} | |
| - name: Check disk after build | |
| if: always() | |
| run: | | |
| echo "=== Disk after Docker build ===" | |
| df -h / | |
| echo "" | |
| echo "=== Docker disk usage ===" | |
| docker system df | |
| - name: Image digest | |
| run: echo ${{ steps.build.outputs.digest }} |