-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathDockerfile
93 lines (79 loc) · 4.18 KB
/
Dockerfile
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
# We use multi-stage builds to end up with a small final image.
# See https://docs.docker.com/build/building/multi-stage
# We have 2 stages, one for building and one just to copy the binaries we want to keep.
################################################################################
# First stage: Building
# Setting up
FROM ubuntu:24.10 AS builder
ENV DEBIAN_FRONTEND noninteractive
WORKDIR /conjure
# All binaries will end up in /root/.local/bin
RUN mkdir -p /root/.local/bin
ENV PATH /root/.local/bin:$PATH
ENV LD_LIBRARY_PATH /root/.local/bin/lib:$LD_LIBRARY_PATH
ENV MZN_STDLIB_DIR /root/.local/bin/share/minizinc
# Dependencies
RUN apt-get update
RUN apt-get install -y --no-install-recommends build-essential # so we can compile stuff
RUN apt-get install -y --no-install-recommends curl ca-certificates # so we can download stack (and other things)
RUN apt-get install -y --no-install-recommends xz-utils # GHC seems to need xz
RUN apt-get install -y --no-install-recommends libgmp-dev # GHC definitely needs GMP
RUN apt-get install -y --no-install-recommends zlib1g-dev # needed when building some solvers (for example bc_minisat_all_release)
RUN apt-get install -y --no-install-recommends cmake # needed when building some solvers (for example boolector)
RUN apt-get install -y --no-install-recommends git # needed when building some solvers (for example boolector)
RUN apt-get install -y --no-install-recommends zip unzip # needed when building some solvers (for example glucose)
RUN apt-get install -y --no-install-recommends autoconf # needed when building some solvers (for example yices)
RUN apt-get install -y --no-install-recommends gperf # needed when building some solvers (for example yices)
RUN apt-get install -y --no-install-recommends python3 # needed when building some solvers (for example z3)
RUN apt-get install -y --no-install-recommends default-jre-headless # savilerow
RUN apt-get install -y --no-install-recommends libnuma-dev # runsolver
# Only copying the install*.sh scripts
RUN mkdir -p etc
COPY etc/build etc/build
# Building solvers. We do this first to facilitate better caching. Also we don't use `make solvers` here for the same reason.
RUN PROCESSES=2 etc/build/install-bc_minisat_all.sh
RUN PROCESSES=2 etc/build/install-boolector.sh
RUN PROCESSES=2 etc/build/install-cadical.sh
RUN PROCESSES=2 etc/build/install-chuffed.sh
# RUN PROCESSES=2 etc/build/install-gecode.sh
RUN PROCESSES=2 etc/build/install-glucose.sh
RUN PROCESSES=2 etc/build/install-kissat.sh
RUN PROCESSES=2 etc/build/install-lingeling.sh
RUN PROCESSES=2 etc/build/install-minion.sh
RUN PROCESSES=2 etc/build/install-minizinc.sh
RUN PROCESSES=2 etc/build/install-nbc_minisat_all.sh
RUN PROCESSES=2 etc/build/install-open-wbo.sh
RUN PROCESSES=2 etc/build/install-ortools.sh
RUN PROCESSES=2 etc/build/install-yices.sh
RUN PROCESSES=2 etc/build/install-z3.sh
RUN PROCESSES=2 etc/build/install-runsolver.sh
# An attempt to cache more
COPY Makefile Makefile
COPY etc/hs-deps etc/hs-deps
COPY conjure-cp.cabal conjure-cp.cabal
RUN make installdeps
# Copy the rest
COPY etc etc
COPY src src
COPY LICENSE LICENSE
RUN make install
# List the binaries
RUN ls -l /root/.local/bin
RUN du -sh /root/.local/bin
# Copy the allsolvers test case
RUN mkdir -p tests
COPY tests/allsolvers tests/allsolvers
# a test to see if all solvers work as expected
RUN tests/allsolvers/test.sh
################################################################################
# Second stage: Copying the binaries
FROM ubuntu:24.10
WORKDIR /conjure
ENV PATH /root/.local/bin:$PATH
ENV LD_LIBRARY_PATH /root/.local/bin/lib:$LD_LIBRARY_PATH
ENV MZN_STDLIB_DIR /root/.local/bin/share/minizinc
RUN apt-get update && apt-get install -y --no-install-recommends build-essential # so we can compile stuff
RUN apt-get update && apt-get install -y --no-install-recommends default-jre-headless # savilerow
RUN apt-get update && apt-get install -y --no-install-recommends libnuma-dev # runsolver
RUN mkdir -p /root/.local/bin/lib
COPY --from=builder /root/.local/bin /root/.local/bin