[REFACTOR] chat api 수정 #49
Workflow file for this run
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: CI | |
| on: | |
| pull_request: | |
| branches: [develop] | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
| - name: Build Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| push: false | |
| tags: ${{ secrets.DOCKER_HUB_USERNAME }}/commit-api:latest | |
| - name: Run container and check if it stays up for 5 seconds | |
| run: | | |
| docker run -d --name test-container ${{ secrets.DOCKER_HUB_USERNAME }}/commit-api:latest | |
| sleep 5 | |
| CONTAINER_STATUS=$(docker inspect -f '{{.State.Running}}' test-container) | |
| docker logs test-container | |
| docker stop test-container | |
| docker rm test-container | |
| if [ "$CONTAINER_STATUS" != "true" ]; then | |
| echo "Container exited too early! Failing the build." | |
| exit 1 | |
| fi | |
| - name: Push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| push: true | |
| tags: ${{ secrets.DOCKER_HUB_USERNAME }}/commit-api:latest |