Build locally and deploy through a registry

Build an image on your machine, push it to a registry, and deploy it with yoink.

Read as MarkdownEdit on GitHub

Build a service image with your local docker daemon, push it to a registry, and deploy it. For the reasons to use this mode, see Deploy modes.

Prerequisites

  • A Dockerfile for the service.
  • A registry that you can push to. The example uses ghcr.io.

Build, push, and deploy

Add a build: block to the service

Set image: to the real registry path.

services:
  - name: api
    image: ghcr.io/you/api          # real registry path
    tag: dev
    build:
      context: .
      dockerfile: Dockerfile
      args:
        RUST_VERSION: "1.95"
    run:
      port: 8080

Log in to the registry

docker login ghcr.io                 # one-time

Build and push the image

yoink build --service api --push     # docker build → docker push ghcr.io/you/api:dev

yoink runs docker build, tags the image as <image>:<tag>, and runs docker push.

Deploy the service

yoink up --service api               # ship from the local daemon → rolling swap

Because the service has a build: block, yoink sends the image from your local docker daemon to each host over SSH. The host does not pull the image from the registry. Then yoink does a rolling swap.

See also

Type a flag, a config field, or a task.