Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Commit 58b25e8

Browse files
committed
Support a bionic variant that builds against the newer libssl.
This is so we can more easily install these packages in Chef v2 and stop fighting the mysql client and other things that depend on libssl-dev.
1 parent 6308c5c commit 58b25e8

File tree

2 files changed

+61
-24
lines changed

2 files changed

+61
-24
lines changed

build_ruby.go

+6-24
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,8 @@ import (
1818

1919
var (
2020
distros = map[string]string{
21-
"ubuntu_precise": "ubuntu:12.04",
22-
"ubuntu:12.04": "ubuntu:12.04",
23-
24-
"ubuntu_raring": "ubuntu:13.04",
25-
"ubuntu:13.04": "ubuntu:13.04",
26-
27-
"ubuntu_trusty": "ubuntu:14.04",
28-
"ubuntu:14.04": "ubuntu:14.04",
29-
30-
"ubuntu_xenial": "ubuntu:16.04",
31-
"ubuntu:16.04": "ubuntu:16.04",
32-
33-
"ubuntu_bionic": "ubuntu:18.04",
34-
"ubuntu:18.04": "ubuntu:18.04",
35-
36-
"centos:6.6": "centos:6.6",
21+
"ubuntu:18.04": "ubuntu:18.04",
22+
"ubuntu:18.04:libssl": "ubuntu:18.04:libssl", // drop this variant once we move beyond bionic
3723
}
3824

3925
docker_client *docker.Client
@@ -358,12 +344,10 @@ func dockerFileFromTemplate(distro, ruby_version, arch, iteration string, patche
358344
// This would be way better as a look up table, or with a more formal lookup process
359345
var template_location string
360346
switch distro {
361-
case "centos:6.6":
362-
template_location = "data/Dockerfile-centos.template"
363-
case "ubuntu:16.04":
364-
template_location = "data/Dockerfile-xenial.template"
365347
case "ubuntu:18.04":
366348
template_location = "data/Dockerfile-bionic.template"
349+
case "ubuntu:18.04:libssl": // drop this variant once we move beyond bionic
350+
template_location = "data/Dockerfile-bionic-libssl.template"
367351
default:
368352
template_location = "data/Dockerfile.template"
369353
}
@@ -393,12 +377,10 @@ func dockerFileFromTemplate(distro, ruby_version, arch, iteration string, patche
393377

394378
func gemfilesFromDistro(distro string) (string, string) {
395379
switch distro {
396-
case "centos:6.6":
397-
return "data/Gemfile.centos", "data/Gemfile.centos.lock"
398-
case "ubuntu:16.04":
399-
return "data/Gemfile.xenial", "data/Gemfile.xenial.lock"
400380
case "ubuntu:18.04":
401381
return "data/Gemfile.bionic", "data/Gemfile.bionic.lock"
382+
case "ubuntu:18.04:libssl": // drop this variant once we move beyond bionic
383+
return "data/Gemfile.bionic", "data/Gemfile.bionic.lock"
402384
default:
403385
return "data/Gemfile.template", "data/Gemfile.template.lock"
404386
}
+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Only produces builds for ruby >= 2.4 due to the newer openssl
2+
# see https://3.basecamp.com/2914079/buckets/21350690/todos/4209849128
3+
#
4+
# We should drop this variant when we move beyond bionic
5+
6+
# Can't use {{.Distro}} since it's ubuntu:18.04:libssl
7+
FROM ubuntu:18.04
8+
RUN apt-get update
9+
RUN apt-get install -y build-essential \
10+
libc6-dev libffi-dev libgdbm-dev libncurses5-dev \
11+
libreadline-dev libssl-dev libyaml-dev zlib1g-dev \
12+
curl ruby ruby-dev
13+
RUN ["/usr/bin/gem", "install", "bundler", "-v", "1.17.3", "--no-rdoc", "--no-ri"]
14+
ADD Gemfile /
15+
ADD Gemfile.lock /
16+
RUN ["bundle", "install"]
17+
18+
RUN curl {{.DownloadUrl}}|tar oxzC /tmp
19+
{{range .Patches}}ADD {{.}} /
20+
{{end}}
21+
WORKDIR /tmp/ruby-{{.RubyVersion}}
22+
RUN for i in `/bin/ls /*.patch`; do patch -p0 < $i; done
23+
RUN CFLAGS='-march=x86-64 -O3 -fno-fast-math -g3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -std=iso9899:1999 -fPIC' ./configure \
24+
--prefix=/opt/ruby{{.RubyVersion}} \
25+
--enable-shared \
26+
--disable-install-doc \
27+
--enable-load-relative
28+
# Seems to only affect some 1.9 series Rubies, but the combined make step:
29+
#
30+
# RUN make -j8 install DESTDIR=/tmp/fpm
31+
#
32+
# that ran the make then make install, was broken. Splitting it up into
33+
# two separate commands works fine:
34+
RUN make -j{{.NumCPU}}
35+
RUN make install DESTDIR=/tmp/fpm
36+
37+
WORKDIR /
38+
RUN fpm \
39+
-s dir \
40+
-t deb \
41+
-n ruby-{{.RubyVersion}} \
42+
-a {{.Arch}} \
43+
-v {{.RubyVersion}} \
44+
{{.Iteration}}
45+
-d libc6-dev \
46+
-d libffi-dev \
47+
-d libgdbm-dev \
48+
-d libncurses5-dev \
49+
-d libreadline-dev \
50+
-d libssl-dev \
51+
-d libyaml-dev \
52+
-d zlib1g-dev \
53+
-C /tmp/fpm \
54+
-p /{{.FileName}} \
55+
opt

0 commit comments

Comments
 (0)