Search code examples
dockerfluttercontinuous-integrationgithub-actionsgoogle-container-registry

GitHub Actions flutter-action job fails when I use a private container


Container registry setup

I use the following Dockerfile to create an image that I then push to google cloud container registry as a private image. I want to run my CD workflow in my workflow so that I can fetch deployment credentials that I store within my image.

Side Note: Not sure if this is the safest method to be managing sensitive files such as .jks files I need to deploy my app to play store. I'd appreciate it if anyone could shed some light on this as well (Not sure if I should move this side note to a different SO question).

FROM ubuntu:latest

COPY Gemfile .
COPY Gemfile.lock .
COPY fastlane/ ./fastlane/

Workflow configuration

Following is the contents of my workflow configuration in .github/workflows/main.yml. See here for complete file.

# This is a basic workflow to help you get started with Actions

# [ ... ]

jobs:
  build:
    runs-on: ubuntu-latest

    container:
      image: gcr.io/positive-affirmations-313800/droid-deploy-env:latest
      credentials:
        username: _json_key
        password: ${{ secrets.GCR_JSON_KEY }}

    steps:
      - uses: actions/checkout@v2
        working-directory: $HOME

      - uses: actions/setup-java@v1
        working-directory: $HOME
        with:
          java-version: '12.x'

      - uses: subosito/flutter-action@v1
        working-directory: $HOME
        with:
          flutter-version: '2.0.5'

      # [ ... ]

Error occured :(

But I keep getting this error:

Full logs available here

image


Solution

  • I found the solution to the problem.

    I was just missing xz-utils on my container so I updated my docker image to install it

    Referenced from the related github issue here

    FROM ubuntu:latest
    
    RUN apt-get update && apt-get install -y \
      xz-utils \
      git \
      android-sdk \
      && rm -rf /var/lib/apt/lists/*
    
    COPY Gemfile .
    COPY Gemfile.lock .
    COPY fastlane/ ./fastlane/