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

How to use HTTP header with ADD command #4229

Open
ORESoftware opened this issue Apr 30, 2020 · 6 comments
Open

How to use HTTP header with ADD command #4229

ORESoftware opened this issue Apr 30, 2020 · 6 comments

Comments

@ORESoftware
Copy link

ORESoftware commented Apr 30, 2020

In light of the Github API changes:
https://developer.github.com/changes/2/ (https://developer.github.com/changes/2020-02-10-deprecating-auth-through-query-param/)

this won't really work in the near future:

ARG token
ADD "<url>?access_token=$token"  .

instead we are gonna have to do:

RUN curl -H "Authorization: token $token" "url"  >  bar

is there a way to use a header with ADD or should we just use curl?

@thaJeztah
Copy link
Member

@tonistiigi @AkihiroSuda ptal

@AkihiroSuda
Copy link
Member

I suggest using RUN --mount=type=secret curl

@ORESoftware
Copy link
Author

@AkihiroSuda umm what is that? can you link to docs so other people can find it easily?

@AkihiroSuda
Copy link
Member

AkihiroSuda commented May 1, 2020

https://docs.docker.com/develop/develop-images/build_enhancements/#new-docker-build-secret-information

$ docker build --secret id=token,src=token.txt ...

Dockerfile:

# syntax = docker/dockerfile:1-experimental
FROM ...
...
RUN --mount=type=secret,id=token,dst=/token.txt \
  curl -H "Authorization: token $(cat /token.txt)" ...

@ORESoftware
Copy link
Author

right but we can use a multi-stage build to get rid of the secrets or whatever, this issue is more about how to ADD with http headers instead of just a url, something like:

ADD --headers <url>  '.'

@thaJeztah
Copy link
Member

Let me transfer this ticket to the BuildKit issue tracker, which is where the Dockerfile syntax is now maintained.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants