The docker-compose will automatically read the .env file if it resides in a same with the docker-compose.yml directory. With this in mind, I go ahead and in .env file define the app-container environment variable to store the container URL, like so:
app-container=12345.dkr.ecr.us-west-2.amazonaws.com/container-image:v003In a docker-compose.yml file I then substitute the container URL with the environment variable app-container.
    version: '3'
    services:
      app1:
        build:
          context: .
          dockerfile: my.dockerfile
          image: ${app-container}It would be great if I could pass the same app-container environment variable to substitute the container's URL defined in Helm's values.yaml file. So, instead of storing the container's URL explicitly
app:
  image: 12345.dkr.ecr.us-west-2.amazonaws.com/container-image:v003the Helm's values.yaml file could use the same app-container environment variable that was already defined in .env file and used by docker-compose. The Helm's values.yaml file could be then simply defined as:
app:
  image: ${app-container}I wonder if sharing the same env file between docker-compose and Helm is possible?
Not directly, you would have to write a script to convert one format into the other.
Try this, its little hacky way:
.env file.$ cat .env
appcontainer=12345.dkr.ecr.us-west-2.amazonaws.com/container-image:v003
$ while read LINE; do export "$LINE"; done < .envNOTE: You need to remove - from app-container name. Otherwise you will get this error while setting environment variable bash: export: app-container=12345.dkr.ecr.us-west-2.amazonaws.com/container-image:v003': not a valid identifier
--set option.helm install --set app.image=$appcontainer ./mychartBut ideally it would be good to have separate env for your docker-compose and helm chart.
Hope this helps.