feat(dev): run localhost dev server in a Lima VM on macOS #416
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 Coolify (SHA) | |
| on: | |
| push: | |
| branches: ["main"] | |
| permissions: | |
| contents: read | |
| packages: write | |
| env: | |
| GITHUB_REGISTRY: ghcr.io | |
| DOCKER_REGISTRY: docker.io | |
| IMAGE_NAME: "coollabsio/coolify" | |
| jobs: | |
| build-push: | |
| outputs: | |
| short_sha: ${{ steps.version.outputs.short_sha }} | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: amd64 | |
| platform: linux/amd64 | |
| runner: ubuntu-24.04 | |
| - arch: aarch64 | |
| platform: linux/aarch64 | |
| runner: ubuntu-24.04-arm | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| persist-credentials: false | |
| - name: Resolve internal version | |
| id: version | |
| run: | | |
| BASE_VERSION=$(docker run --rm -v "$(pwd):/app" -w /app php:8.2-alpine3.16 php bootstrap/getVersion.php) | |
| echo "version=${BASE_VERSION}-dev.${GITHUB_SHA::9}" >> "$GITHUB_OUTPUT" | |
| echo "short_sha=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT" | |
| - name: Login to ${{ env.GITHUB_REGISTRY }} | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.GITHUB_REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Login to ${{ env.DOCKER_REGISTRY }} | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.DOCKER_REGISTRY }} | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build and Push Image (${{ matrix.arch }}) | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: docker/production/Dockerfile | |
| platforms: ${{ matrix.platform }} | |
| push: true | |
| build-args: | | |
| COOLIFY_VERSION=${{ steps.version.outputs.version }} | |
| tags: | | |
| ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:sha-${{ steps.version.outputs.short_sha }}-${{ matrix.arch }} | |
| ${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME }}:sha-${{ steps.version.outputs.short_sha }}-${{ matrix.arch }} | |
| merge-manifest: | |
| runs-on: ubuntu-24.04 | |
| needs: build-push | |
| steps: | |
| - uses: docker/setup-buildx-action@v3 | |
| - name: Login to ${{ env.GITHUB_REGISTRY }} | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.GITHUB_REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Login to ${{ env.DOCKER_REGISTRY }} | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.DOCKER_REGISTRY }} | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Create & publish manifest on ${{ env.GITHUB_REGISTRY }} | |
| env: | |
| REGISTRY: ${{ env.GITHUB_REGISTRY }} | |
| SHA: ${{ needs.build-push.outputs.short_sha }} | |
| run: | | |
| IMAGE="${REGISTRY}/${IMAGE_NAME}" | |
| docker buildx imagetools create \ | |
| "${IMAGE}:sha-${SHA}-amd64" \ | |
| "${IMAGE}:sha-${SHA}-aarch64" \ | |
| --tag "${IMAGE}:sha-${SHA}" | |
| - name: Create & publish manifest on ${{ env.DOCKER_REGISTRY }} | |
| env: | |
| REGISTRY: ${{ env.DOCKER_REGISTRY }} | |
| SHA: ${{ needs.build-push.outputs.short_sha }} | |
| run: | | |
| IMAGE="${REGISTRY}/${IMAGE_NAME}" | |
| docker buildx imagetools create \ | |
| "${IMAGE}:sha-${SHA}-amd64" \ | |
| "${IMAGE}:sha-${SHA}-aarch64" \ | |
| --tag "${IMAGE}:sha-${SHA}" | |
| - uses: sarisia/actions-status-discord@v1 | |
| if: always() | |
| with: | |
| webhook: ${{ secrets.DISCORD_WEBHOOK_DEV_RELEASE_CHANNEL }} |