Skip to content

Pass basic-auth credentials to child images #44

@jmreicha

Description

@jmreicha

Is your feature request related to a problem? Please describe.

When attempting to get basic auth working with the satispress plugin I am running into some issues.

As part of my build process I do composer update and then, docker build . --file Dockerfile --tag image:tag and it works well, but when I attempt to add packages using satispress with composer and an accompanying auth.json that sits next to composer.json for basic-auth I get the following error.

 [Composer\Downloader\TransportException]                                                                 
  The 'https://mydomain.com/satispress/affiliate-wp/2.6.3' URL required authentication.  
  You must be using the interactive console to authenticate                                                
                                                                                                           

install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packages>]...

The command '/bin/bash -o pipefail -c composer install --no-dev --no-interaction --no-progress --no-ansi --no-scripts' returned a non-zero code: 255

I'm thinking auth credentials are never picked up as part of the build. It looks like there is a way to set up the auth with the COMPOSER_AUTH environment variable as part of the build but don't know if there is a way to inject this into the Docker build.

Describe the solution you'd like

Ideally a build arg for enabling a way to pass COMPOSER_AUTH with specified credentials in the child Dockerfile. Something like docker build . --file Dockerfile --build-arg COMPOSER_AUTH='{"http-basic": {"domain": {"username": "abc", "password": "123"}}}' --tag image:tag and something in the Dockerfile for passing the onbuild env.

It looks like passing this arg should be possible using this approach.

Additional context

I originally opened an issue in the stack-example-bedrock repo but it looks like that is probably not the best place for it. I'm still parsing through the repo trying to understand how everything is built so I can try testing this locally.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions