aantron/dream

signal handling in dockerfile

Opened this issue · 3 comments

When trying out one of the docker examples like example/z-docker-opam, I noticed I can't seem to stop the docker without using docker kill. Adding an entrypoint like tini launches the process as pid 1 and makes the signal handling work as expected:

RUN apk add --update libev gmp tini
...
ENV TINI_VERSION v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-muslc-amd64 /tini
RUN chmod +x /tini
ENTRYPOINT ["/tini", "--"]
CMD ["/bin/app"]

(I also had to add gmp-dev in the build stage and gmp in the run stage. I assume this is due to a dependency change and I can pr this change alone to fix the image.)

About the GMP issue:
I think adding conf-gmp as a dependency in esy should solve it without doing anything else. If it's not enough I can find the correct resolution to make it work.

For opam, I also found this tip here for installing any extra deps using opam depext:

# in builder
RUN opam depext | sed 's/-dev//' > depexts`
...
# in run
COPY --from=0 /home/opam/depexts depexts
RUN cat depexts | xargs apk add && rm -rf /var/cache/apk/*

Thanks!

I won't be able to look into this immediately, but I'll be happy to merge any PRs with improvements, and in the meantime I hope this issue helps others.