Skip to content

New dockers configuration section #5733

@caarlos0

Description

@caarlos0

Currently, our Docker configuration is too repetitive, and the implementation is kinda old as well.

Since then, we added Ko support, which included the Docker engine and etc into our dependencies.

So, in theory, we can probably recreate the Docker stuff, without using the Docker CLI, at least for the manifest creation.

We can also take this time to improve the configuration format to be less repetitive.
Here's how it could look like:

dockers:
  - images:
      - "goreleaser/goreleaser"
      - "ghcr.io/goreleaser/goreleaser"
    tags:
      - "v{{ .Version }}"
      - "{{ if not .IsNightly }}latest{{ end }}"
      - "{{ if .IsNightly }}nightly{{ end }}"
    dockerfile: Dockerfile # default
    use: buildx # default
    platforms:
      - linux/amd64
      - linux/arm64
    labels:
      io.artifacthub.package.readme-url: "https://raw.githubusercontent.com/goreleaser/goreleaser/main/README.md"
      io.artifacthub.package.logo-url: "https://goreleaser.com/static/avatar.png"
      io.artifacthub.package.maintainers: '[{"name":"Carlos Alexandro Becker","email":"carlos@carlosbecker.dev"}]'
      io.artifacthub.package.license: "MIT"
      org.opencontainers.image.description: "Release engineering, simplified"
      org.opencontainers.image.created: "{{.Date}}"
      org.opencontainers.image.name: "{{.ProjectName}}"
      org.opencontainers.image.revision: "{{.FullCommit}}"
      org.opencontainers.image.version: "{{.Version}}"
      org.opencontainers.image.source: "{{.GitURL}}"
    build_flag_templates:
      - "--pull" 
    extra_files:
      - scripts/entrypoint.sh

This would replace both dockers and docker_manifests in the current configuration.

This would mean deprecating many options in dockers, and the entire docker_manifests as well.

Discussed in https://github.com/orgs/goreleaser/discussions/5442
Another discussion in https://github.com/orgs/goreleaser/discussions/5991

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions