How to use multiple image tags with docker-compose

I have some nice and clean solution using environment variables (bash syntax for default variable value, in my case it is latest but you can use anything ), this is my compose:

version: '3'
services:
  app:
    build: .
    image: myapp-name:${version:-latest}

build and push (if you need to push to the registry) with the default tag, change the version using environment variable and build and push again:

docker-compose build
docker-compose push
export version=0.0.1
docker-compose build
docker-compose push

You can also take the following approach:

# build is your actual build spec
build:
  image: myrepo/myimage
  build:
  ...
  ...
# these extend from build and just add new tags statically or from environment variables or 
version_tag:
  extends: build
  image: myrepo/myimage:v1.0
some_other_tag:
  extends: build
  image: myrepo/myimage:${SOME_OTHER_TAG}

You can then just run docker-compose build and docker-compose push and you will build and push the correct set of tagged imaged