/
Dockerfile.erb
113 lines (76 loc) · 3.05 KB
/
Dockerfile.erb
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
108
109
110
111
112
113
# Python toolchain as of this writing is available on rhel62, debian92 and
# ubuntu1604.
#
# To run rhel62 in docker, host system must be configured to emulate syscalls:
# https://github.com/CentOS/sig-cloud-instance-images/issues/103
<%
python_toolchain_url = "https://s3.amazonaws.com//mciuploads/mongo-python-driver-toolchain/#{distro}/ba92de2700c04ee2d4f82c3ffdfc33105140cb04/mongo_python_driver_toolchain_#{distro.gsub('-', '_')}_ba92de2700c04ee2d4f82c3ffdfc33105140cb04_19_11_14_15_33_33.tar.gz"
server_version = '4.3.3'
server_url = "http://downloads.10gen.com/linux/mongodb-linux-x86_64-enterprise-#{distro}-#{server_version}.tgz"
server_archive_basename = File.basename(server_url)
server_extracted_dir = server_archive_basename.sub(/\.(tar\.gz|tgz)$/, '')
toolchain_upper='f11598d091441ffc8d746aacfdc6c26741a3e629'
toolchain_lower='5e46f2793e8e866f36eda2c5_20_02_14_19_18_18'
ruby_toolchain_url = "https://s3.amazonaws.com//mciuploads/mongo-ruby-toolchain/#{distro}/#{toolchain_upper}/mongo_ruby_driver_toolchain_#{distro.gsub('-', '_')}_patch_#{toolchain_upper}_#{toolchain_lower}.tar.gz"
%>
FROM <%= base_image %>
<% if debian? %>
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install -y curl
<% end %>
<% if ruby_head? %>
RUN curl --retry 3 -fL <%= python_toolchain_url %> -o python-toolchain.tar.gz
RUN tar -xC /opt -zf python-toolchain.tar.gz
<% end %>
<% if debian? %>
# Ruby runtime dependencies: libyaml-0-2
# Compiling ruby libraries: gcc make
# JRuby: openjdk-8-jre
# Server dependencies: libsnmp30 libcurl3
# Determining OS we are running on: lsb-release
# Kerberos testing: krb5-user
# Installing mlaunch from git: git
# ruby-head archive: bzip2
# ubuntu1204, ubuntu1404 only have openjdk-7-jre
<% unless %w(ubuntu1204 ubuntu1404).include?(distro) %>
RUN apt-get install -y openjdk-8-jre
<% end %>
<% if %w(ubuntu1204).include?(distro) %>
RUN apt-get install -y libsnmp15
<% else %>
RUN apt-get install -y libsnmp30
<% end %>
# ubuntu1204, ubuntu1404, ubuntu1604: libcurl3
RUN apt-get install -y libyaml-0-2 gcc make git lsb-release libcurl3 krb5-user bzip2
<% else %>
RUN yum install -y redhat-lsb-core which
<% end %>
<% if preload? %>
WORKDIR /app
RUN curl --retry 3 -fL <%= server_download_url %> -o <%= File.basename(server_download_url) %>
RUN tar xfz <%= File.basename(server_download_url) %>
RUN mv mongo*/ /opt/mongodb
ENV USE_OPT_MONGODB=1
<% unless ruby_head? %>
RUN curl --retry 3 -fL <%= ruby_toolchain_url %> -o ruby-toolchain.tar.gz
RUN tar -xC /opt -zf ruby-toolchain.tar.gz
ENV PATH=/opt/rubies/<%= ruby %>/bin:/opt/rubies/python/3/bin:$PATH
ENV USE_OPT_TOOLCHAIN=1
<% end %>
<% end %>
WORKDIR /app
<% if preload? && !ruby_head? %>
COPY Gemfile .
COPY gemfiles gemfiles
COPY *.gemspec .
COPY lib/mongo/version.rb lib/mongo/version.rb
RUN bundle install
<% end %>
COPY . .
ENV MONGO_ORCHESTRATION_HOME=/tmpfs
ENV PROJECT_DIRECTORY=/app
<% @env.each do |k, v| %>
ENV <%= k %>=<%= v %>
<% end %>
CMD bash -x <%= script %>