News for hackers. Stuff that matters.
Re:Cloud Run Button: Click-to-deploy your Git repos to GCP by minimaxir on Wednesday August 21, 2019 @02:04PM (#20759703)
What's the best way to handle a button like this if you intentionally keep certain dependencies out of Git/GitHub? (e.g. my gpt-2-cloud-run repos [https://github.com/minimaxir/gpt-2-cloud-run] have a 500MB dependency)

Can you do a conditional in the Dockerfile, e.g. download a remote file if using Docker to build with certain parameters?

Re:Cloud Run Button: Click-to-deploy your Git repos to GCP by alpb on Wednesday August 21, 2019 @02:07PM (#20759732)
Off-topic but I think Dockerfile allows downloading remote URLs, e.g.:

     ADD http://example.com ./file.txt
Re:Cloud Run Button: Click-to-deploy your Git repos to GCP by jayd16 on Wednesday August 21, 2019 @02:08PM (#20759752)
I've been using wget like a sucker?!
Re:Cloud Run Button: Click-to-deploy your Git repos to GCP by alpb on Wednesday August 21, 2019 @02:09PM (#20759765)
I think using RUN wget/curl is actually cached better than ADD [URL], which will invalidate your build steps cache more often unless I'm mistaken.
Re:Cloud Run Button: Click-to-deploy your Git repos to GCP by orf on Wednesday August 21, 2019 @02:16PM (#20759865)
It's also easier to clean up, i.e download a file, do something with it and then remove it. With ADD this is impossible.
Re:Cloud Run Button: Click-to-deploy your Git repos to GCP by PhilippGille on Wednesday August 21, 2019 @06:35PM (#20762654)
If I remember correctly it's like this:

RUN cache is invalidated when the text (the whole RUN line) itself changes, which can be bad if you update a remote zip archive that you download with `RUN curl ...` and then expect the image to be updated after a simple `docker build`. This also goes for `RUN apk add ...` where the package might have received critical security updates but you're not getting them into your image because the cache is used.

COPY and ADD caches are invalidated when the hash of the actual file content that's added changes, which is usually what you want.

Re:Cloud Run Button: Click-to-deploy your Git repos to GCP by rcfox on Wednesday August 21, 2019 @05:31PM (#20762053)
Doesn't ADD do the download unconditionally but only invalidate the cache if the contents change?

The only good use for ADD that I've found is for invalidating git clones from GitHub:

    ADD https://api.github.com/repos/<user>/<repo>/git/refs/heads/<branch> version.json
    RUN git clone --depth=1 --single-branch --branch=<branch> https://github.com/<user>/<repo>.git
Re:Cloud Run Button: Click-to-deploy your Git repos to GCP by endgame on Wednesday August 21, 2019 @06:28PM (#20762601)
Over http, without a checksum!?
Re:Cloud Run Button: Click-to-deploy your Git repos to GCP by jayd16 on Wednesday August 21, 2019 @02:07PM (#20759744)
You don't put the docker image in git, so you don't need a conditional in the docker file. You'll only download the dependencies when you make the image assuming you've made it available in that way.