forked from Pike1z/SETSM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
97 lines (78 loc) · 2.6 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
94
95
96
97
# This Dockerfile uses multi-stage building to minimize size
# while maintaining all necessary dependencies. The build
# stage brings in dependencies necessary for building setsm
# and then compiles the source code. The run stage brings the
# executable created from the build stage into a new image and
# includes required dependencies
# Command Line arguments
ARG VERSION=16.04
ARG COMPILER=gnu
# ------------- BUILD STAGE ------------- #
FROM ubuntu:$VERSION as builder
# Bring arguments in from command line
ARG COMPILER
ARG VERSION
# Specify that the bash shell will be used
SHELL ["/bin/bash", "-c"]
# Bring in dependencies
RUN apt-get update && apt-get install --no-install-recommends -y \
libgeotiff-dev \
libgeotiff[0-9]+ \
g++ \
git \
ca-certificates \
make \
wget \
gnupg2 \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Show g++ version
RUN g++ --version
# Find glibc version
RUN apt search glibc
RUN apt search proj-*
RUN apt-get install libproj-dev
# Create file that holds compiler specific paths
RUN touch /opt/compilerpath
# If building Intel version, then install Intel compiler
RUN if [ "$COMPILER" = 'intel' ]; then \
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB; \
apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB; \
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB; \
echo "deb https://apt.repos.intel.com/oneapi all main" | tee /etc/apt/sources.list.d/oneAPI.list; \
apt update; \
apt-get install -y intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic; \
source /opt/intel/oneapi/setvars.sh; \
echo $PATH > /opt/compilerpath; \
ls /opt/intel; \
echo "*** LIBRARY PATHS ***"; \
ls -l /opt/intel/oneapi; \
echo " --- "; \
apt-cache pkgnames intel | grep libiomp; \
ls -l /opt/intel/oneapi/compiler/2021.2.0/linux/lib/x64; \
icpc -V; \
echo **DONE**; \
fi
# Change working directory to /opt
WORKDIR /opt
# Copy all files into /opt
COPY ./* /opt/
# Update path and compiler
ENV PATH="/opt:${PATH}"
ENV COMPILER=$COMPILER
# Bring in compiler-specific paths, and then make the setsm executable
RUN PATH="$(cat compilerpath):$PATH"; make COMPILER=$COMPILER INCS=-I/usr/include/geotiff
# ------------- RUN STAGE ------------- #
FROM ubuntu:$VERSION as runner
ARG COMPILER
# Bring in dependencies
RUN apt-get update && apt-get install --no-install-recommends -y \
libgeotiff[0-9]+ \
libgomp1 \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Make setsmdir and bring files into it
RUN mkdir /opt/setsmdir
COPY --from=builder /opt/setsm /opt/setsmdir/
# Update path
ENV PATH="/opt/setsmdir:${PATH}"
# When image is run, setsm is executed
CMD setsm