docker-build.yml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. name: Build and Push Docker Image
  2. on:
  3. push:
  4. branches: [ master, main ]
  5. workflow_dispatch:
  6. jobs:
  7. build-backend:
  8. runs-on: ubuntu-latest
  9. steps:
  10. - name: Checkout code
  11. uses: actions/checkout@v3
  12. - name: Set up Docker Buildx
  13. uses: docker/setup-buildx-action@v2
  14. - name: Log in to Docker Hub
  15. uses: docker/login-action@v2
  16. with:
  17. username: ${{ secrets.DOCKERHUB_USERNAME }}
  18. password: ${{ secrets.DOCKERHUB_TOKEN }}
  19. - name: Build and push backend
  20. uses: docker/build-push-action@v4
  21. with:
  22. context: ./backend
  23. file: ./backend/Dockerfile
  24. push: true
  25. tags: 537yaha/ai-cs-backend:latest
  26. platforms: linux/amd64,linux/arm64
  27. build-frontend:
  28. runs-on: ubuntu-latest
  29. steps:
  30. - name: Checkout code
  31. uses: actions/checkout@v3
  32. - name: Set up Docker Buildx
  33. uses: docker/setup-buildx-action@v2
  34. - name: Log in to Docker Hub
  35. uses: docker/login-action@v2
  36. with:
  37. username: ${{ secrets.DOCKERHUB_USERNAME }}
  38. password: ${{ secrets.DOCKERHUB_TOKEN }}
  39. - name: Build and push frontend
  40. uses: docker/build-push-action@v4
  41. with:
  42. context: ./frontend
  43. file: ./frontend/Dockerfile
  44. push: true
  45. tags: 537yaha/ai-cs-frontend:latest
  46. platforms: linux/amd64,linux/arm64
  47. build-args: |
  48. NEXT_PUBLIC_API_BASE_URL=http://localhost:18080
  49. NEXT_PUBLIC_BACKEND_PORT=18080