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

Add proxy configuration #75

Open
brcourt opened this issue Jan 30, 2020 · 1 comment
Open

Add proxy configuration #75

brcourt opened this issue Jan 30, 2020 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed p2 Low priority

Comments

@brcourt
Copy link

brcourt commented Jan 30, 2020

cfn submit doesn't seem to work if a proxy is configured. Adding use_config_proxy to the _docker_build method in codegen.py shown below seems to resolve the issue.

@classmethod
def _docker_build(cls, external_path):
    cls._check_for_support_lib_sdist(external_path)

    internal_path = PurePosixPath("/project")
    command = " ".join(cls._make_pip_command(internal_path))
    LOG.debug("command is '%s'", command)

    volumes = {str(external_path): {"bind": str(internal_path), "mode": "rw"}}
    image = f"lambci/lambda:build-{cls.RUNTIME}"
    LOG.warning(
        "Starting Docker build. This may take several minutes if the "
        "image '%s' needs to be pulled first.",
        image,
    )
    docker_client = docker.from_env()
    try:
        logs = docker_client.containers.run(
            image=image,
            command=command,
            auto_remove=True,
            volumes=volumes,
            stream=True,
            use_config_proxy=True   #<=== use proxy configuration if specified in config.json
        )
@ammokhov
Copy link
Contributor

cfn submit doesn't seem to work if a proxy is configured. Adding use_config_proxy to the _docker_build method in codegen.py shown below seems to resolve the issue.

@classmethod
def _docker_build(cls, external_path):
    cls._check_for_support_lib_sdist(external_path)

    internal_path = PurePosixPath("/project")
    command = " ".join(cls._make_pip_command(internal_path))
    LOG.debug("command is '%s'", command)

    volumes = {str(external_path): {"bind": str(internal_path), "mode": "rw"}}
    image = f"lambci/lambda:build-{cls.RUNTIME}"
    LOG.warning(
        "Starting Docker build. This may take several minutes if the "
        "image '%s' needs to be pulled first.",
        image,
    )
    docker_client = docker.from_env()
    try:
        logs = docker_client.containers.run(
            image=image,
            command=command,
            auto_remove=True,
            volumes=volumes,
            stream=True,
            use_config_proxy=True   #<=== use proxy configuration if specified in config.json
        )

we would be happy to take a PR that addresses it

@ammokhov ammokhov added the help wanted Extra attention is needed label Sep 23, 2020
@ericzbeard ericzbeard added enhancement New feature or request p2 Low priority labels Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed p2 Low priority
Projects
None yet
Development

No branches or pull requests

3 participants