-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
107 lines (91 loc) · 2.66 KB
/
Copy pathDockerfile
File metadata and controls
107 lines (91 loc) · 2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# syntax=docker/dockerfile:1
FROM debian:stable-20260623-slim@sha256:ee12ffb55625b99d62837a72f037d9b2f18fd0c787a89c2b9a4f09666c48776c
ARG OPENSSL_VERSION=1.1.1w
ARG JEMALLOC_VERSION=5.3.1
ARG RUBY_VERSION=2.6.10
LABEL \
org.opencontainers.image.title="ruby2.6-jemalloc" \
org.opencontainers.image.description="Ruby ${RUBY_VERSION} image with jemalloc ${JEMALLOC_VERSION}" \
org.opencontainers.image.source="https://github.com/UMNLibraries/ruby2.6-jemalloc-docker"
ENV DEBIAN_FRONTEND=noninteractive
RUN <<__install__
set -eux
# Step: install builder dependencies
apt-get update
apt-get -y upgrade
apt-get install -y --no-install-recommends \
autoconf \
bison \
build-essential \
bzip2 \
ca-certificates \
libdb-dev \
libffi-dev \
libffi8 \
libgdbm-dev \
libgdbm6 \
libncurses5-dev \
libncurses6 \
libreadline-dev \
libreadline8 \
libyaml-0-2 \
libyaml-dev \
pkg-config \
wget \
zlib1g \
zlib1g-dev
rm -rf /var/lib/apt/lists/*
__install__
# Build OpenSSL 1.1.1 (required by Ruby 2.6; Debian ships OpenSSL 3 which is incompatible)
WORKDIR /tmp/build
RUN <<__openssl__
set -eux
# Step: download OpenSSL source
wget -q "https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz"
tar xzf "openssl-${OPENSSL_VERSION}.tar.gz"
cd "openssl-${OPENSSL_VERSION}"
# Step: configure and build OpenSSL
./config --prefix=/opt/openssl --openssldir=/opt/openssl shared zlib
make -j"$(nproc)"
make test
make install_sw
# Step: clean OpenSSL build artifacts
rm -rf /tmp/build/openssl-*
__openssl__
# Build jemalloc
RUN <<__jemalloc__
set -eux
# Step: download jemalloc source
wget -q "https://github.com/jemalloc/jemalloc/releases/download/${JEMALLOC_VERSION}/jemalloc-${JEMALLOC_VERSION}.tar.bz2"
tar xjf "jemalloc-${JEMALLOC_VERSION}.tar.bz2"
cd "jemalloc-${JEMALLOC_VERSION}"
# Step: configure and build jemalloc
./configure --prefix=/usr/local
make -j"$(nproc)"
make test
make install
# Step: clean jemalloc build artifacts
rm -rf /tmp/build/jemalloc-*
__jemalloc__
# Build Ruby 2.6.x with jemalloc and OpenSSL 1.1.1
ENV LD_LIBRARY_PATH=/opt/openssl/lib:/usr/local/lib
RUN <<__ruby__
set -eux
wget -q "https://cache.ruby-lang.org/pub/ruby/2.6/ruby-${RUBY_VERSION}.tar.gz"
tar xzf "ruby-${RUBY_VERSION}.tar.gz"
cd "ruby-${RUBY_VERSION}"
./configure \
--prefix=/usr/local \
--with-openssl-dir=/opt/openssl \
--with-jemalloc \
--enable-shared \
--disable-install-doc \
--disable-install-rdoc \
CFLAGS="-O2 -fno-omit-frame-pointer -Wno-error=implicit-function-declaration"
make -j"$(nproc)"
make test
make install
rm -rf /tmp/build/ruby-*
ldconfig /opt/openssl/lib /usr/local/lib
__ruby__
CMD ["irb"]