MCPcopy Index your code
hub / github.com/dockito/compose2bash

github.com/dockito/compose2bash @v1.6.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.6.0 ↗ · + Follow
8 symbols 16 edges 1 files 4 documented · 50%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

compose2bash

Tool that converts docker-compose.yml (former fig.yml) files to bash scripts.

Download

Releases

Usage

compose2bash -yml=examples/docker-compose.yml -output=examples/output -app=myapp

Example

docker-compose.yml

api:
  command: npm start
  image: docker.mydomain.com/api:latest
  ports:
    - 3000
  environment:
    VIRTUAL_PORT: 3000
    VIRTUAL_HOST: api.mydomain.com
    NODE_ENV: development
    MONGO_DATABASE: develop_api
  volumes:
    - .:/src
  privileged: True

output: myapp-api.1.sh

#!/bin/bash
/usr/bin/docker pull docker.mydomain.com/api:latest

if /usr/bin/docker ps | grep --quiet myapp-api_1 ; then
    /usr/bin/docker rm -f myapp-api_1
fi

/usr/bin/docker  run \
    --restart=always \
    -d \
    --name myapp-api_1 \
    -v .:/src  \
    --link myapp-redis_1:redis  \
    -e MONGO_DATABASE="develop_api" -e NODE_ENV="development" -e VIRTUAL_HOST="api.mydomain.com" -e VIRTUAL_PORT="3000"  \
    -p 3000  \
    docker.mydomain.com/api:latest npm start

output: myapp-api.1.sh with -interactive-bash

#!/bin/bash
/usr/bin/docker  pull docker.mydomain.com/api:latest

if /usr/bin/docker  ps -a | grep --quiet myapp-api_1 ; then
    /usr/bin/docker  rm -f myapp-api_1
fi


while [ "$#" -gt 0 ]; do case "$1" in
    --interactive-bash) interactivebash="true"; shift 1;;
    *) shift;;
  esac
done

if [[ $interactivebash == "true" ]]; then
    /usr/bin/docker  run \
        -ti \
        --name myapp-api_1 \
        -v .:/src  \
        --link myapp-redis_1:redis  \
        -e MONGO_DATABASE="develop_api" -e NODE_ENV="development" -e VIRTUAL_HOST="api.mydomain.com" -e VIRTUAL_PORT="3000"  \
        -p 3000  \
        docker.mydomain.com/api:latest bash
else
    /usr/bin/docker  run \
        --restart=always \
        -d \
        --name myapp-api_1 \
        -v .:/src  \
        --link myapp-redis_1:redis  \
        -e MONGO_DATABASE="develop_api" -e NODE_ENV="development" -e VIRTUAL_HOST="api.mydomain.com" -e VIRTUAL_PORT="3000"  \
        -p 3000  \
        docker.mydomain.com/api:latest npm start
fi

Options

  • -v: Show the current version
  • -app: Application name
  • -output: Output directory (default .)
  • -yml: Compose file path (default docker-compose.yml)
  • -docker-host: Docker host connection
  • -interactive-bash: Include option to run the generated script with interactive bash. Running the generated script without any argument will executed it normally. But running it with --interactive-bash will execute the container with interactive bash. Pretty handful for debug.

Build

Using goxc.

goxc

Core symbols most depended-on inside this repo

loadYaml
called by 1
main.go
setLinksWithAppName
called by 1
main.go
removeBlankLinkes
called by 1
main.go
buildScriptDataTemplate
called by 1
main.go
saveToBash
called by 1
main.go
main
called by 0
main.go

Shape

Function 6
Struct 2

Languages

Go100%

Modules by API surface

main.go8 symbols

Datastores touched

(mongodb)Database · 1 repos

For agents

$ claude mcp add compose2bash \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact