Continuous Deployment with Buildkite

Outline:

I have a working Buildkite pipeline that builds an image with docker compose, pushes to the fly registry, then deploys that image with flyctl deploy. I remember auth and caching being funky because of how stages are ran on potentially different agents. I’m happy to share my setup with you if it helps.

Yeah, I feel like that would definitely help. Do you have a GH repo somewhere that we can reference? Thanks!

Here’s my pipeline.yml file. The rest is straight from this tutorial https://buildkite.com/docs/tutorials/docker-containerized-builds.

steps:
  - command: sh scripts/test.sh
    plugins:
      - docker-compose#v3.3.0:
          run: test
          config:
            - docker-compose.yml
            - docker-compose.test.yml
  - label: ":docker: Build"
    branches: master
    plugins:
      - docker-compose#v3.3.0:
          build:
            - web
            - worker
            - sync
  - wait
  - label: "setup flyctl"
    branches: master
    commands:
      - curl -L https://fly.io/install.sh | FLYCTL_INSTALL=/usr/local sh
      - flyctl auth docker
  - wait
  - label: ":docker: Push"
    branches: master
    plugins:
      - docker-compose#v3.2.0:
          push:
            - worker:registry.fly.io/FLY-APP:commit-$BUILDKITE_COMMIT
  - wait
  - label: "Release fly"
    branches: master
    commands:
      - flyctl deploy -i "registry.fly.io/FLY-APP:commit-$BUILDKITE_COMMIT" -c fly.toml --detach