build deps on different platform

Hi all,

I have a phoenix umbrella app that I build a docker container for using alpine and deploy via github actions. I was wondering if anyone knew a way I could build dependencies outside of the container so I can cache them?

Thanks!

1 Like

Well, as long as OS is the same you can build dependencies on host system and COPY deps . in Dockerfile. I’ve done that in the past in CircleCI when I had “build” job in the image with the same OS so I could cache that step in CircleCI and later pass to docker.

Yeah, that’s part of the problem, apologies if I wasn’t clear on that in the OP. Github Actions doesn’t provide for the ability to use alpine as a runner, so I’m stuck using ubuntu. However, I run the images in production on alpine because it’s much smaller. The main difference is Ubuntu uses GLibC whereas Alpine uses MUSL.

BTW! Not related to the question, but still want to share :slightly_smiling_face:

In our company we recently moved all services from alpine to fedora. Sure - the image size of the single particular image has grown for a couple of hundred MB. However, since we are running 80+ services in k8s cluster, those base OS layers of docker image are cached and reused between containers that run on the same server.

Regarding musl vs glibc: while for elixir services I didn’t notice any major difference - our ruby services got performance boost around 10-20% “for free” after moving to fedora.