This repository contains scripts for creating docker images that are available in multiple variants. The goal is to publish docker images with operational jemalloc libraries, maintaining minimal size while providing full functionality.
Older versions of alpine do not include a jemalloc package in the official repositories. If you are using a newer version of alpine, you can install jemalloc with apk add jemalloc, and this image becomes unnecessary.
Jemalloc is a general-purpose malloc(3) implementation that focuses on minimizing fragmentation and supporting scalable concurrency. It is especially efficient in managing dynamic memory allocation and deallocation in concurrent environments.
The published images adhere to a naming convention.
The image name follows the format:
anonychun/alpine-jemalloc
The tags represent version numbers and follow the format:
<1>-<2>
<1>corresponds to the version of the alpine image.<2>corresponds to the jemalloc version.
For example: 3.16-5.3.0
You can use this image as a base for your projects. If a version you require is missing, please open an issue in this repository.
FROM anonychun/alpine-jemalloc:<version>docker pull anonychun/alpine-jemalloc:<version>If you are using another image based on alpine, you can use the following Dockerfile as a starting point. Simply replace ruby:3.2.2-alpine3.16 with the alpine-based image you wish to use.
FROM anonychun/alpine-jemalloc:3.16-5.3.0 AS jemalloc
FROM ruby:3.2.2-alpine3.16 AS base
# Copy the jemalloc libraries
COPY --from=jemalloc /usr/local/lib/libjemalloc* /usr/local/lib/
# Set jemalloc as the default allocator
ENV LD_PRELOAD=/usr/local/lib/libjemalloc.so.2Feel free to open an issue or a pull request with suggestions.
Please note that the build process for these images can be quite time-consuming.