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

feat: add support for proxy settings during docker build #45

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docker/kayobe/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ ARG BASE_IMAGE="quay.io/centos/centos:stream8"
FROM ${BASE_IMAGE}
MAINTAINER "Will Szumski" <[email protected]>

ARG http_proxy
ARG https_proxy
Comment on lines +10 to +11

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already pass these args in when building the image in SKC CI. Presumably they were unused.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also see that http(s)_proxy are referenced on L69, perhaps coming from Docker config?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that is the case then we would need to move them before download packages as SMSLab kayobe-automation cannot build unless these proxy settings are present.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's wait for Will to get the history on this.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CC @jovial

Copy link
Collaborator

@jovial jovial Jan 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I did once bake in the the proxy environment variables as env vars, but I recall I had issues when using the same image in another environment (which used another proxy). Passing these variables in at runtime seemed like the better option. Is this the only way to set a proxy at build time? I thought there were some command line parameters to docker build 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will investigate further. Good point about sharing the image between environment and still carrying the proxy settings.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we could make them not persistent after build that would be ideal. Can we get away with the build arg only and possibly pass them in like this:

RUN http_proxy=$http_proxy https_proxy=$http_proxy ./script

or possibly you can clear the env var?

Copy link
Collaborator

@jovial jovial Jan 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed the comment in https://github.com/stackhpc/kayobe-automation/pull/45/files#r1440221535, so that code is still in there. I guess this isn't so bad then. My feeling is that approach of baking it in was a bit of a mistake though.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is the magic that means that you don't need to explicitly define the build arg: https://docs.docker.com/engine/reference/builder/#predefined-args

ENV http_proxy $http_proxy
ENV https_proxy $https_proxy

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's quite common to also need no_proxy, but I note that Will had problems will commas.


# Unclear at this time if different environments will change
# control host bootstrap.
ARG KAYOBE_ENVIRONMENT=""
Expand Down
Loading