Skip to content
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

Pass basic-auth credentials to child images #44

Open
jmreicha opened this issue Jan 6, 2021 · 2 comments
Open

Pass basic-auth credentials to child images #44

jmreicha opened this issue Jan 6, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@jmreicha
Copy link

jmreicha commented Jan 6, 2021

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.

@jmreicha
Copy link
Author

I have not had any success injecting the auth config as an environment variable with build args, BUT I was able to modify the upstream Docker image and get the basic-auth working by injecting a local auth.json file into the Dockerfile on this line.

I don't think this is a viable solution though, because the build fails if there is no auth.json file present in the bedrock repo that composer generates. Not sure if there is a way around that.

@jmreicha
Copy link
Author

Just opened https://github.com/presslabs/stack-runtimes/pull/45. I think this should be enough to address the original issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant