How do I pass values to docker compose from GitHub Action workflow

Viewed 12

How does one pass a value to the docker-compose file from an action workflow? In my GitHub workflow, I have a build step comprising of ...

- name: Build Compose Images
  env: 
    IMAGE_TAG: ${{ steps.preamble.outputs.releasetag }}
  run: IMAGE_TAG=${{env.IMAGE_TAG }} docker compose -f compose.yaml build

with docker-compose file ...

version: "3"
services:
db:
  build: MySQL
  environment:
    IMAGE_TAG: ${IMAGE_TAG}
  image: "repo/image:${IMAGE_TAG}"
  ports: 
   - '3306:3306'

In each case nothing seems to work unless I hard code a value in an environment block, which is not ideal. Thanks.

1 Answers

hmm that actually works if I remove the environment key in the docker-compose file.

Related