|
| 1 | +name: Publish Docker Image |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + |
| 8 | +jobs: |
| 9 | + build-and-push: |
| 10 | + name: Build & Push UI Image |
| 11 | + runs-on: ubuntu-latest |
| 12 | + |
| 13 | + steps: |
| 14 | + - name: Checkout Code |
| 15 | + uses: actions/checkout@v4 |
| 16 | + |
| 17 | + # --- Step to restore untracked proprietary dependencies --- |
| 18 | + - name: Restore Proprietary Dependencies (Base64) |
| 19 | + if: "${{ secrets.LIBS_TGZ_BASE64 != '' }}" |
| 20 | + run: | |
| 21 | + echo "Restoring libs/ folder from LIBS_TGZ_BASE64 secret..." |
| 22 | + echo "${{ secrets.LIBS_TGZ_BASE64 }}" | base64 --decode | tar -xzf - |
| 23 | +
|
| 24 | + - name: Restore Proprietary Dependencies (Signed URL) |
| 25 | + if: "${{ secrets.LIBS_DOWNLOAD_URL != '' && secrets.LIBS_TGZ_BASE64 == '' }}" |
| 26 | + run: | |
| 27 | + echo "Downloading libs/ archive from LIBS_DOWNLOAD_URL secret..." |
| 28 | + curl -sSL -o libs.tar.gz "${{ secrets.LIBS_DOWNLOAD_URL }}" |
| 29 | + tar -xzf libs.tar.gz |
| 30 | + rm -f libs.tar.gz |
| 31 | +
|
| 32 | + - name: Check libs/ Directory Structure |
| 33 | + run: | |
| 34 | + if [ -d "libs" ]; then |
| 35 | + echo "libs/ directory found. Number of files:" |
| 36 | + ls -1 libs/ | wc -l |
| 37 | + else |
| 38 | + echo "WARNING: libs/ directory not found! Docker build will likely fail." |
| 39 | + fi |
| 40 | +
|
| 41 | + # --- Set up Docker Buildx --- |
| 42 | + - name: Set up QEMU |
| 43 | + uses: docker/setup-qemu-action@v3 |
| 44 | + |
| 45 | + - name: Set up Docker Buildx |
| 46 | + uses: docker/setup-buildx-action@v3 |
| 47 | + |
| 48 | + # --- Log in to Docker Hub --- |
| 49 | + - name: Log in to Docker Hub |
| 50 | + uses: docker/login-action@v3 |
| 51 | + with: |
| 52 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 53 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 54 | + |
| 55 | + # --- Build and Push --- |
| 56 | + - name: Build and Push Docker Image |
| 57 | + uses: docker/build-push-action@v6 |
| 58 | + with: |
| 59 | + context: . |
| 60 | + file: ./Dockerfile |
| 61 | + push: true |
| 62 | + tags: | |
| 63 | + unmtransinfo/carlsbad_ui:latest |
| 64 | + unmtransinfo/carlsbad_ui:${{ github.sha }} |
| 65 | + cache-from: type=gha |
| 66 | + cache-to: type=gha,mode=max |
0 commit comments