RUN curl \
https://raw.githubusercontent.com/apliteni/docker-entrypoint-library/main/docker-entrypoint-library.sh \
-o /docker-entrypoint-library.sh
RUN wget \
https://raw.githubusercontent.com/apliteni/docker-entrypoint-library/main/docker-entrypoint-library.sh \
-O /docker-entrypoint-library.sh
Source it and use
source /docker-entrypoint-library.sh
CONTAINER_NAME=my-container
MY_CONTAINER_CONTAINER_RAM_PCTS=5
detect_total_ram_size | to_mebibytes # prints something like 16384 if you have 16G RAM
calculate_container_ram_size | to_mebibytes # prints something like 819 (5% of RAM) if you have 16G RAM
log_info "Some useful info message"
if something_wrong; then
fail "This is fatal error"
fi