genuinetools / img

Standalone, daemon-less, unprivileged Dockerfile and OCI compatible container image builder.
https://blog.jessfraz.com/post/building-container-images-securely-on-kubernetes/
MIT License
3.88k stars 230 forks source link

docker-compose support #283

Open henres opened 4 years ago

henres commented 4 years ago

Hello here, thanks for your great works !

In our CI we use docker-compose to build our images. Will it be possible to make something like this : img build -docker-compose-file mon-docker-compose.yaml

For example in one of our docker-compose.yaml for build :

version: '3.5'
services:
    php_fpm:
        image: "private_registry/project-x/php-fpm${SUB_REGISTRY}:${VERSION_TAG:?}"
        build:
            context: "./php-fpm"
            args:
                APP_VERSION: "${APP_TAG:?}"
                ENABLE_BLACKFIRE: 'false'
                ENABLE_XDEBUG: 'false'
                SSH_PRIVATE_KEY: '${SSH_PRIVATE_KEY:?}'
                CLONE_REPOSITORY: 'private_repository/project-x.git'
                CLONE_BRANCH: '${CLONE_BRANCH:?}'
                YARN_COMMAND: '${YARN_COMMAND:?}'
                SERVER_ENV: '${SERVER_ENV:?}'
                SYMFONY_ENV: '${SYMFONY_ENV:?}'

    nginx:
        image: "private_registry/project-x//nginx${SUB_REGISTRY}:${VERSION_TAG:?}"
        build:
            context: "./nginx"
            args:
                APP_VERSION: "${APP_TAG:?}"
                BUILD_TAG: "${VERSION_TAG:?}"
                SUB_REGISTRY_FOLDER: "${SUB_REGISTRY:?}"
        depends_on:
            - "php_fpm"

It works great for dependencies !

Have a nice week !

abdennour commented 3 years ago

We're in the same boat. We have a single docker-compose.yaml that defines our build and pushes tagged images. It also fires up the stack for local development. Very neat, because there's a single source of truth, and we run the same docker-compose build in GCB. Simple and repeatable.

The only downside is that we can't use the IMG