localstack / localstack/serverless-localstack

Specify profile for docker compose in config

未关闭
#265 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

enhancement status: backlog
主要语言
JavaScript
星标
542
派生
92
PR 合并指标
30 天内没有已合并 PR

描述

Problem

I have multiple profiles configured in my docker-compose.yml file. I would like to only run the containers tagged with a particular profile with via this plugin's docker compose up command.

Example

Example compose file:

# docker-compose.yml
services:
  localstack:
    profiles:
      - local
    container_name: '${LOCALSTACK_DOCKER_NAME:-localstack-main}'
    image: localstack/localstack
    ports:
      - 4566:4566 # LocalStack Gateway
      - 4510-4559:4510-4559 # external services port range
    environment:
      # LocalStack configuration: https://docs.localstack.cloud/references/configuration/
      - DEBUG=${DEBUG:-0}
    volumes:
      - '${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack'
      - '/var/run/docker.sock:/var/run/docker.sock'

  redis-local:
    profiles:
      - local
    image: redis:7.2.4-alpine
    ports:
      - 6379:6379
    command: redis-server --logLevel notice --requirepass pass

  redis-test:
    profiles:
      - test
    image: redis:7.2.4-alpine
    ports:
      - 6379:6379
    command: redis-server --logLevel notice --requirepass pass

And the compose up command:

docker compose --profile local up -f docker-compose.yml

Read more about compose profiles here.

When specifying the local profile it shouldn't create the redis-test container.

Suggested solution

Can add an optional parameter to config.docker to specify the profile(s) to be run in the docker compose up command.

e.g.

custom:
  localstack:
    docker:
      profiles:
       - local

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先跟踪 plugin 如何读取自定义 config.docker 并构造 docker compose up 命令。添加对可选 profile 或 profiles 值的支持,然后使用包含 local 和 test profile 的 Compose 文件进行验证,确保只启动选定的 profile。

由索引模型根据 Issue 内容生成。

评估

技术栈
docker, docker-compose, javascript
领域
devops
Issue 类型
功能
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
50/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。