Foreman with Docker alpine

I should mention, that I did run the above Dockerfile against version 1.19.1 (git branch “1.19-stable”).
However, due to considerable changes between the version, I think I go now straight ahead with unreleased 1.23. Also I think instead of trying to fix DB upgrade/DB migration (which I have as reported already here with 1.19.1) I will recreate new Instance from sratch.

I was able to produce 2 images, one based on your Dockerfile with pure sqlite DB and the other with postgresql DB. Only the second one (foreman-1.23-alpine) was producing a container with working foreman installation, while the first is missing a sqlclient library, which seems to be necessary for connectiing to sqlite DB. Now, as you can see from below listing, the actual images sizes didn’t match the sizes you obtained.

#  IMAGE                     SIZE
1  foreman-levy-alpine       505MB
2  foreman-1.23-alpine       533MB

What could be the reason, that I get a different image size ?

Steps to create the image:

git clone https://github.com/ohadlevy/foreman.git
git checkout remotes/origin/alpine
docker build -t foreman-levy-alpine .

For comparison please find the actual sizes of directories(trees) with significant contributions to image/container size:

~ # du -d 1 -h /usr/ |sort -k 1 -g -r |grep "^[0-9]\+\.[0-9]M"
264.8M  /usr/
166.3M  /usr/bin
42.1M   /usr/lib
34.3M   /usr/local
15.2M   /usr/share
6.7M    /usr/include


~ # du -d 1 -h /home/foreman/ |sort -k 1 -g -r |grep "^[0-9]\+\.[0-9]M"
292.2M  /home/foreman/
197.9M  /home/foreman/vendor
64.4M   /home/foreman/public
12.0M   /home/foreman/app
5.8M    /home/foreman/locale
4.7M    /home/foreman/test
3.4M    /home/foreman/webpack
1.9M    /home/foreman/db

I did that:

but got image with quasi same size as I already had, when building myself:

quay.io/ohadlevy/foreman  alpine  4ba1510ef1e5  47 hours ago  500MB

that’s probably my fault as I was running short in time when running this, I can only assume that at same stage it didn’t include either some gems (in vendor) or some minified javascript output under public.

your sizes are actually in line with what I would expect the difference from our official containers.

tl;dr - I would just use the container we ship instead of build your own.