grammarly/rocker

Build args only passed in to first stage of build

zicklag opened this issue · 4 comments

I am trying to build a Rockerfile from behind an HTTP proxy and have been having issues with the way that the build arguments like http_proxy, https_proxy, and no_proxy are passed in at build time. Here is a very simple Rockerfile I am using as an example.

Rockerfile:

FROM alpine:latest
RUN apk update

FROM alpine:latest
RUN apk update

When I try to build it I get:

rocker build --build-arg http_proxy=$http_proxy --build-arg https_proxy=$https_proxy --build-arg no_proxy="$no_proxy" --no-cache
INFO[0000] FROM alpine:latest                
INFO[0000] | Image sha256:7328f                          size=3.966 MB
INFO[0000] RUN apk update                    
INFO[0000] | Created container dc1dadbae68d (image sha256:7328f) 
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/community/x86_64/APKINDEX.tar.gz
v3.6.2-130-gfde2d8ebb8 [http://dl-cdn.alpinelinux.org/alpine/v3.6/main]
v3.6.2-125-g93038b573e [http://dl-cdn.alpinelinux.org/alpine/v3.6/community]
OK: 8441 distinct packages available
INFO[0003] Commit changes                    
INFO[0003] | Result image is sha256:03aaa                size=5.067 MB (+1.101 MB)
INFO[0003] | Removing container dc1dadbae68d            
INFO[0003] Cleaning up                       
INFO[0003] ====================================         
INFO[0003] FROM alpine:latest                
INFO[0003] | Image sha256:7328f                          size=3.966 MB
INFO[0003] RUN apk update                    
INFO[0004] | Created container 86ce0259fae1 (image sha256:7328f) 
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/community/x86_64/APKINDEX.tar.gz
ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.6/main: operation timed out
WARNING: Ignoring APKINDEX.84815163.tar.gz: No such file or directory
^CINFO[0216] Received SIGINT, remove current container... 
INFO[0216] | Removing container 86ce0259fae1 

The build arguments are successfully passed into the first container, but when Rocker starts the second stage of the build, the arguments are not passed in and apk will fail to update ( and I interrupt the process ).

I really want to use Rocker, but this is kind of a show-stopper for me. Any help would be greatly appreciated.

Thanks for asking. Unfortunately, we are discontinuing this project. See the notice here: https://github.com/grammarly/rocker/blob/master/README.md

Closing this issue as we are not able to address this one. Sorry.

That's OK, I found out very soon afterwards that Docker now had multistage builds, which meant that I didn't need Rocker as much. Thanks for the notification.

The only missing part I still like to have from Rocker is MOUNT. I'm using Gradle to build java programs, MOUNT is very useful to prevent the building process from re-downloading all dependencies every single time.

I tried the suggestions like COPY the dependency description file only, then download all dependencies and utilize docker's cache system. But that only works well for languages like python or node.js because pip and npm uses only one file to describe the dependencies. While in gradle, it requires folder hierarchy to be exist before you can build, not even mention multiple module projects have many gradle.build and other files in submodules' directories.

Mount was the one thing that I did miss from Rocker. I just wanted it because it is way faster than doing a full COPY at every build step.

You might want to try out Drone. Drone lets you write containerized build pipelines and it uses a Docker volume to persist the working directory at each step. Drone is a CI server, but you can also use the CLI to execute the build plans locally if you don't want to use the CI server.