Skip to content

Improve Docker build pipeline #3336

@nicolargo

Description

@nicolargo

For the moment a Docker image is generated from the master branch (for the latest and latest-full branch). It is not what we want.

We want:

  • delete images generation for master/main
  • for a tag generate latest/latest-full

Proposal (to be tested):

env:
      DEFAULT_DOCKER_IMAGE: nicolargo/glances
      PUSH_BRANCH: ${{ 'refs/heads/develop' == github.ref || startsWith(github.ref, 'refs/tags/v') }}
      # ...

and:

- name: Determine image tags
  id: config
  shell: bash
  run: |
    if [[ $GITHUB_REF == refs/tags/* ]]; then
      VERSION=${GITHUB_REF#refs/tags/v}
      TAG_ARRAY="[{ \"target\": \"minimal\", \"tag\": \"${VERSION}\" },"
      TAG_ARRAY="$TAG_ARRAY { \"target\": \"minimal\", \"tag\": \"latest\" },"
      TAG_ARRAY="$TAG_ARRAY { \"target\": \"full\", \"tag\": \"${VERSION}-full\" },"
      TAG_ARRAY="$TAG_ARRAY { \"target\": \"full\", \"tag\": \"latest-full\" }]"
    elif [[ $GITHUB_REF == refs/heads/develop ]]; then
      TAG_ARRAY="[{ \"target\": \"dev\", \"tag\": \"dev\" }]"
    else
      TAG_ARRAY="[]"
    fi

    echo "Tags to build: $TAG_ARRAY"
    echo "tags=$TAG_ARRAY" >> $GITHUB_OUTPUT

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions