From 5cd23725d1aa4a2fc6d37224b97605333166cb81 Mon Sep 17 00:00:00 2001 From: Tilen Komel Date: Tue, 29 Oct 2024 12:47:25 +0100 Subject: [PATCH] Simplified build --- .github/workflows/build.yaml | 21 +++++++++--- .github/workflows/dockerhub-push.yaml | 46 --------------------------- 2 files changed, 17 insertions(+), 50 deletions(-) delete mode 100644 .github/workflows/dockerhub-push.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index be111e1..ccdfdd4 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -13,20 +13,33 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Build APP + - name: Log in to DockerHub + if: github.ref == 'refs/heads/main' + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push APP Docker image uses: docker/build-push-action@v6 with: context: "{{defaultContext}}" file: ./app/Dockerfile + push: ${{ github.ref == 'refs/heads/main' }} + tags: komelt/meshtastic-map:latest - - name: Build API + - name: Build and push API Docker image uses: docker/build-push-action@v6 with: context: "{{defaultContext}}" file: ./api/Dockerfile - - - name: Build MQTT + push: ${{ github.ref == 'refs/heads/main' }} + tags: komelt/meshtastic-map-api:latest + + - name: Build and push MQTT Docker image uses: docker/build-push-action@v6 with: context: "{{defaultContext}}" file: ./mqtt/Dockerfile + push: ${{ github.ref == 'refs/heads/main' }} + tags: komelt/meshtastic-map-mqtt:latest \ No newline at end of file diff --git a/.github/workflows/dockerhub-push.yaml b/.github/workflows/dockerhub-push.yaml deleted file mode 100644 index 24909b7..0000000 --- a/.github/workflows/dockerhub-push.yaml +++ /dev/null @@ -1,46 +0,0 @@ -name: build-push - -on: - push: - branches: - - main - -jobs: - docker: - runs-on: ubuntu-latest - steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: "${{ secrets.DOCKERHUB_USERNAME }}" - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push APP - uses: docker/build-push-action@v6 - with: - context: "{{defaultContext}}" - push: true - file: "./app/Dockerfile" - tags: ${{ secrets.DOCKERHUB_USERNAME }}/meshtastic-map:latest - - - name: Build and push API - uses: docker/build-push-action@v6 - with: - context: "{{defaultContext}}" - push: true - file: "./api/Dockerfile" - tags: ${{ secrets.DOCKERHUB_USERNAME }}/meshtastic-map-api:latest - - - name: Build and push MQTT listener - uses: docker/build-push-action@v6 - with: - context: "{{defaultContext}}" - push: true - file: "./mqtt/Dockerfile" - tags: ${{ secrets.DOCKERHUB_USERNAME }}/meshtastic-map-mqtt:latest