forked from mame/quine-relay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.gen.rb
23 lines (19 loc) · 996 Bytes
/
Dockerfile.gen.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require_relative "code-gen"
apts = RunSteps.flat_map {|s| s.apt }
other_packages = %w(libpng-dev libgd-dev groff flex bison curl)
apts = [*apts.flatten.compact.uniq, *other_packages].uniq.sort
dockerfile = []
dockerfile << "FROM ubuntu:#{ `bash -c 'source /etc/os-release && echo $VERSION_ID'`.chomp }"
dockerfile << "ENV DEBIAN_FRONTEND noninteractive"
dockerfile << "RUN rm /etc/dpkg/dpkg.cfg.d/excludes" # maxima requires /usr/share/doc/maxima/...
dockerfile << "RUN apt-get update && apt-get upgrade -y"
dockerfile << "RUN apt-get -qq install -y apt-utils > /dev/null"
dockerfile << "RUN apt-get -qq install -y moreutils"
apts.each_slice(4) do |apt|
dockerfile << "RUN chronic apt-get -qq install -y #{ apt.join(" ") } && chronic apt-get clean"
end
dockerfile << "ADD . /usr/local/share/quine-relay"
dockerfile << "WORKDIR /usr/local/share/quine-relay"
dockerfile << "RUN make -C vendor"
dockerfile << "CMD make check -j 10000"
File.write("../Dockerfile", dockerfile.join("\n") + "\n")