Hello,
I do have a beginner question. Is it possible to build a docker image directly
from the sr.ht? If so, how?
I do:
$ docker build -t www https://git.sr.ht/~qeef/damn-www
That returns the error:
Sending build context to Docker daemon 17.41kBs://git.sr.ht/~qeef/damn-www 15.59kB
Error response from daemon: Dockerfile parse error line 1: unknown instruction: <!DOCTYPE
For completeness:
$ docker --version
Docker version 19.03.12, build 48a66213fe
I tried to debug a little but I don't know much where to look.
Thanks!
jiri
On 2020-11-12 2:44 PM, Jiri Vlasak wrote:
> $ docker build -t www https://git.sr.ht/~qeef/damn-www
Unfortunately, Docker assumes every HTTPS git URL ends with ".git",
which Sourcehut does not support. You can use the SSH clone URL, but
(unless this has changed recently) you'll need to be using a key that's
authorized on your account or Sourcehut will reject the SSH clone entirely.
On 20-11-12 22:44:23, Jiri Vlasak wrote:
> Hello,> > I do have a beginner question. Is it possible to build a docker image directly> from the sr.ht? If so, how?
Hi Jiri,
I think the way to do this is to build the docker image in the repo
where the Dockerfile actually is. Then you push the image to a docker
repository that you can then pull where you need it to.
Cheers,
/Marius
Thanks guys.
> Unfortunately, Docker assumes every HTTPS git URL ends with ".git",
Thanks for pointing me out! I found the issue where it's discussed [1].
> which Sourcehut does not support.
I just renamed `my-repository` to `my-repository.git`. Ugly hack from [1] but
it works.
> You can use the SSH clone URL, but (unless this has changed recently)
It didn't changed and I don't want to use that. (It works for me locally but
it's not enough.)
> I think the way to do this is to build the docker image in the repo
Thanks for suggestion but it's not good enough for the intended use-case.
Thanks again!
jiri
[1]: https://github.com/docker/cli/issues/1738
what I wanted to do:
build: https://git.sr.ht/~edwardloveall/scribe#main
image: scribe:latest
resulted in:
ERROR: error detecting content type for remote
https://git.sr.ht/~edwardloveall/scribe: unsupported Content-Type
"text/html; charset=utf-8"
(.git url → https://http.cat/403 )
what I'm defaulting to: I'm not familiar with sourcehut systems; set up
Github Actions on:crontab
(what I ended up doing today: not deploying it, nothing, writing mail)
Are *.git URLs a crime, why/how? [needinfo] I didn't find any discussion
about it, other than 'x is bad, not our problem'. The fact is, it _is_
non-functional.
I agree, that moby doesn't have the perfect implementation, so I dug in
to some code: (likely just notes to a week-month older self)
1. Detect() in detect.go[^d]: urlutil.IsGitURL[^ig] returns false
1. Fallback to generic URL remote (what expects a text/plain Dockerfile
or GET tarball)
For starters, is there a special header you send to identify that you
are a git client? Both github(.git) and sourcehut respond with
text/html.[^ask] [needinfo]
[^ig]: just return suffix == .git
https://github.com/moby/moby/blob/eddbd6ff1ebf3df92129cc301d00693381f89d64/pkg/urlutil/urlutil.go#L33
[^d]: detect.go
https://github.com/moby/moby/blob/97ede9df264c08bcf752c70569d6c87fe5c9e98d/builder/remotecontext/detect.go#L28
[^ask]: expecting/hoping reader to know, fallback to rtfm/spec should be
reliable
-jc