question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Executing wrong Dockerfile

See original GitHub issue

Hello,

I’m having trouble when building an image from a Dockerfile. For example, in this execution, the Docker command is wrong, it should be RUN sdkmanager --sdk_root=/opt/sdk --install "build-tools;27.0.3" and not RUN sdkmanager --sdk_root=/opt/sdk --install "build-tools;21.1.2".

Here is the Dockerfile I’m using and here the step of the workflow.

Dockerfile:

FROM alvrme/alpine-android-base:jdk8
LABEL maintainer="Álvaro S. <alvaro@alvr.me>"

ENV BUILD_TOOLS "27.0.3"
ENV TARGET_SDK "27"
ENV PATH $PATH:${ANDROID_SDK_ROOT}/build-tools/${BUILD_TOOLS}

# Install SDK Packages
RUN sdkmanager --sdk_root=${ANDROID_SDK_ROOT} --install "build-tools;${BUILD_TOOLS}" "platforms;android-${TARGET_SDK}" && \
    sdkmanager --sdk_root=${ANDROID_SDK_ROOT} --uninstall emulator

Configuration:

- name: Build Android API 27 JDK8
  uses: docker/build-push-action@v2
  with:
    context: ./android-27
    file: ./android-27/jdk8.Dockerfile
    no-cache: true
    push: true
    tags: |
      ${{ env.DH_IMAGE_NAME }}:android-27
      ${{ env.DH_IMAGE_NAME }}:android-27-jdk8
      ghcr.io/${{ env.GHCR_IMAGE_NAME }}:android-27
      ghcr.io/${{ env.GHCR_IMAGE_NAME }}:android-27-jdk8
      quay.io/${{ env.QUAY_IMAGE_NAME }}:android-27
      quay.io/${{ env.QUAY_IMAGE_NAME }}:android-27-jdk8

In that run, the steps for “Build Android API 21 JDK8” trought “Build Android API 28 JDK8” are having the same problems, all are using the wrong command (except API 21 that is correct)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
crazy-maxcommented, Dec 23, 2020

@alvr

but I would also need to add a tag only for one version of the matrix.

You can use something like this:

  build_images_jdk8:
    name: Build Images JDK8
    needs: [build_base_image_jdk8]
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        android-api:
          - 21
          - 22
          - 23
          - 24
          - 25
          - 26
          - 27
          - 28
          - 29
          - 30
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Tags
        run: |
          TAGS="android-${{ matrix.android-api }}"
          TAGS="$TAGS,android-${{ matrix.android-api }}-jdk8"
          if [ "${{ matrix.android-api }}" = "30" ]; then
            TAGS="$TAGS,latest"
            TAGS="$TAGS,latest-jdk8"
          fi
          echo "TAGS=$TAGS" >> $GITHUB_ENV

      - name: Docker meta
        id: docker_meta
        uses: crazy-max/ghaction-docker-meta@v1
        with:
          images: |
            ${{ env.DH_IMAGE_NAME }}
            ghcr.io/${{ env.GHCR_IMAGE_NAME }}
            quay.io/${{ env.QUAY_IMAGE_NAME }}
          tag-custom: ${{ env.TAGS }}
          tag-custom-only: true

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v1

      - name: Login to DockerHub
        uses: docker/login-action@v1
        with:
          username: ${{ env.DOCKERHUB_USER }}
          password: ${{ secrets.DOCKERHUB_PASS }}

      - name: Login to GitHub Container Registry
        uses: docker/login-action@v1
        with:
          registry: ghcr.io
          username: ${{ github.repository_owner }}
          password: ${{ secrets.GHCR_PASS }}

      - name: Login to Quay
        uses: docker/login-action@v1
        with:
          registry: quay.io
          username: ${{ env.QUAY_USER }}
          password: ${{ secrets.QUAY_PASS }}

      - name: Build Android API ${{matrix.android-api }} JDK8
        uses: docker/build-push-action@v2
        with:
          context: ./android-${{ matrix.android-api }}
          file: ./android-${{ matrix.android-api }}/jdk8.Dockerfile
          no-cache: true
          push: true
          tags: ${{ steps.docker_meta.outputs.tags }}
0reactions
crazy-maxcommented, Aug 30, 2021

Fixed since BuildKit 0.9.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dockerfile build - possible to ignore error? - Stack Overflow
Sure. Docker is just responding to the error codes returned by the RUN shell scripts in the Dockerfile . If your Dockerfile has...
Read more >
9 Common Dockerfile Mistakes - Runnablog
9 Common Dockerfile Mistakes · 1. Running apt-get · 2. Using ADD instead of COPY · 3. Adding your entire application directory in...
Read more >
How to Fix and Debug Docker Containers Like a Superhero
Confirm that permissions are incorrect. Run a chmod 774 command to let this file read, write, and execute for all users. Use docker...
Read more >
Docker build failes with dockerfile created by VS
Original dockerfile generated by VS2017: I'm using containers for linux. The error I'm getting in both cases (locally executing `docker build` and CI ......
Read more >
Error when execute "docker-compose up" - SitePoint
Hello there, I have 2 errors when executing “docker-compose up” docker-databaseimportexport-1 | ERROR 1396 (HY000) at line 1: Operation ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found