Closed lukechilds closed 4 years ago
Interesting. I always blindly assumed that the final binaries depend on this stuff at runtime, but it does seem like they don't indeed 🤔.
$ ldd /opt/bitcoin-0.19.0.1/bin/bitcoin* | grep opt | wc -l
0
I'd rather we didn't discard other binaries produced, namely:
bitcoin-cli
bitcoin-wallet
bitcoin-tx
bitcoind
Also, when you remove the PATH
line, does the below still work?
docker run -it --rm --entrypoint=bitcoin-cli lncm/bitcoind:v0.19.0.1 --version
Ah, you can also remove stripping of the stuff above that's not being copied in (L115, L125-126).
Ah, forget about my PATH question, only now notices you copy them into a different location.
I've made the changes requested.
Beautiful :)
Copying
/opt
directly over from the build stage to the final image ends up with a load of build stage dependencies from Berkley DB and Bitcoin Core bloating the image that aren't required at runtime.By just copying over the
bitcoind
andbitcoin-cli
binaries you end up with a nice slim image, saving about 30MB. It reduces the image size from 50MB to 20MB, that's less than half the original size!I hope I'm not misunderstanding something and you didn't intentionally want to keep the Berkley DB/Bitcoin Core installation files in this image. I was working under the assumption that this is just supposed to be a super lightweight Docker wrapper for
bitcoind
.I've only made the changes to
0.19/Dockerfile
for now for you to test. Let me know if you're happy with this change and I'll update the other versions.