|
| 1 | +name: Docker Build and Push |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + push: |
| 7 | + description: 'Whether to push the image' |
| 8 | + required: true |
| 9 | + type: boolean |
| 10 | + tags: |
| 11 | + description: 'Image tags to apply' |
| 12 | + required: true |
| 13 | + type: string |
| 14 | + labels: |
| 15 | + description: 'Optional image labels' |
| 16 | + required: false |
| 17 | + default: '' |
| 18 | + type: string |
| 19 | + registry: |
| 20 | + description: 'Registry URL (optional)' |
| 21 | + required: false |
| 22 | + type: string |
| 23 | + username: |
| 24 | + description: 'Registry password (optional)' |
| 25 | + required: false |
| 26 | + type: string |
| 27 | + password: |
| 28 | + description: 'Registry password (optional)' |
| 29 | + required: false |
| 30 | + type: string |
| 31 | + |
| 32 | +jobs: |
| 33 | + build: |
| 34 | + runs-on: ubuntu-latest |
| 35 | + |
| 36 | + steps: |
| 37 | + - name: Checkout code |
| 38 | + uses: actions/checkout@v5 |
| 39 | + |
| 40 | + - name: Set up Docker Buildx |
| 41 | + uses: docker/setup-buildx-action@v3 |
| 42 | + |
| 43 | + - name: Log in to registry |
| 44 | + uses: docker/login-action@v3 |
| 45 | + with: |
| 46 | + registry: ${{ inputs.registry }} |
| 47 | + username: ${{ inputs.username }} |
| 48 | + password: ${{ inputs.password }} |
| 49 | + |
| 50 | + - name: Build and push Docker image |
| 51 | + uses: docker/build-push-action@v6 |
| 52 | + with: |
| 53 | + push: ${{ inputs.push }} |
| 54 | + tags: ${{ inputs.tags }} |
| 55 | + labels: ${{ inputs.labels }} |
| 56 | + cache-from: type=gha |
| 57 | + cache-to: type=gha,mode=max |
| 58 | + build-args: | |
| 59 | + REACT_APP_SERVER_URL=${{ secrets.REACT_APP_SERVER_URL }} |
| 60 | + REACT_APP_CLIENT_ID=${{ secrets.REACT_APP_CLIENT_ID }} |
| 61 | + REACT_APP_PUBLIC_VAPID_KEY=${{ secrets.REACT_APP_PUBLIC_VAPID_KEY }} |
| 62 | + REACT_APP_ENCRYPTION_KEY=${{ secrets.REACT_APP_ENCRYPTION_KEY }} |
| 63 | + REACT_APP_GOOGLE_MAPS_API_KEY=${{ secrets.REACT_APP_GOOGLE_MAPS_API_KEY }} |
| 64 | + REACT_APP_GOOGLE_MAPS_MAP_ID=${{ secrets.REACT_APP_GOOGLE_MAPS_MAP_ID }} |
0 commit comments