Skip to content

chore: update docker-compose.yml to v2 #4494

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 30, 2025

Conversation

Marukome0743
Copy link
Contributor

Description

Build:

  • Update docker-compose.yml to Docker Compose v2 syntax and convert environment variables to key-value format

Motivation and Context

1. Remove Version top-level element (obsolete)

The top-level version property is defined by the Compose Specification for backward compatibility. It is only informative and you'll receive a warning message that it is obsolete if used.

2. Use mapping syntax instead of sequence syntax

- SSH_AUTH_SOCK=/.ssh-agent/socket
+ SSH_AUTH_SOCK: /.ssh-agent/socket

The new FOO: BAR mapping syntax is prefer to - FOO=BAR sequence syntax at 2 points.

Fragments

First mapping syntax can use Fragments.

services:
  first:
    image: my-image:latest
    environment: &env
      FOO: BAR
      ZOT: QUIX
  second:
    image: another-image:latest
    environment:
      <<: *env
      YET_ANOTHER: VARIABLE

In example above, the environment variables must be declared using the FOO: BAR mapping syntax, while the sequence syntax - FOO=BAR is only valid when no fragments are involved.

Readable in IDE

sequence syntax mapping syntax
sequence mapping

The above images are Visual Studio Code.

The sequence syntax shows the all orange color environment variables.
On the other hand, the mapping syntax divides them into blue and orange color texts.
Therefore you can read them using FOO: BAR mapping syntax easily.

In conclusion, FOO: BAR mapping syntax is better than - FOO=BAR sequence syntax.

Usage examples

services:
  commitlint:
    build:
      context: .
      dockerfile: Dockerfile.dev
    image: marionebl/commitlint-cubicle
    ports:
      - "8443:8443"
    environment:
      SSH_AUTH_SOCK: /.ssh-agent/socket
      SSH_AUTH_PROXY_SOCK: /.ssh-agent/proxy-socket
    volumes:
      - .:/root/repo
      - $SSH_AUTH_SOCK:/.ssh-agent/socket
    command: code-server --no-auth /root/repo

How Has This Been Tested?

I have tested on GitHub Codespaces.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@escapedcat
Copy link
Member

Thanks for your detailed PRs! Really helpful!

@escapedcat escapedcat merged commit 85ea3a1 into conventional-changelog:master Jun 30, 2025
12 checks passed
@Marukome0743 Marukome0743 deleted the v2 branch June 30, 2025 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants