Skip to content

Commit c65056f

Browse files
authored
Merge pull request #2 from sr-murthy/master
Various updates
2 parents 502dc29 + f26c30e commit c65056f

File tree

3 files changed

+72
-43
lines changed

3 files changed

+72
-43
lines changed

Dockerfile

+37-42
Original file line numberDiff line numberDiff line change
@@ -4,64 +4,59 @@ MAINTAINER The HDF-EOS Tools and Information Center <[email protected]>
44

55
ENV HOME /root
66

7-
RUN apt-get update
8-
RUN apt-get -yq install gcc \
9-
build-essential \
10-
wget \
11-
bzip2 \
12-
tar \
13-
libghc-zlib-dev \
14-
libjpeg-dev \
15-
gfortran \
16-
bison \
17-
flex \
18-
file
7+
COPY ["./apt.txt", "./"]
198

20-
#Build HDF4
21-
RUN wget https://observer.gsfc.nasa.gov/ftp/edhs/hdfeos/latest_release/hdf-4.2.13.tar.gz; \
22-
tar zxvf hdf-4.2.13.tar.gz; \
23-
cd hdf-4.2.13; \
9+
RUN apt update && apt install -yq $(grep -vE "^\s*#" ./apt.txt)
10+
11+
#Build HDF4 lib.
12+
ARG HDF4_VER=4.2.13
13+
RUN wget https://observer.gsfc.nasa.gov/ftp/edhs/hdfeos/latest_release/hdf-${HDF4_VER}.tar.gz; \
14+
tar zxvf hdf-${HDF4_VER}.tar.gz; \
15+
cd hdf-${HDF4_VER}; \
2416
./configure --prefix=/usr/local/ --disable-netcdf; \
2517
make && make check && make install; \
2618
cd ..; \
27-
rm -rf /hdf-4.2.13 /hdf-4.2.13.tar.gz
19+
rm -rf /hdf-${HDF4_VER} /hdf-${HDF4_VER}.tar.gz
2820

29-
#Build HDF-EOS2
30-
RUN wget https://observer.gsfc.nasa.gov/ftp/edhs/hdfeos/previous_releases/HDF-EOS2.19v1.00.tar.Z; \
31-
tar zxvf HDF-EOS2.19v1.00.tar.Z; \
21+
#Build HDF-EOS2 lib.
22+
ARG HDFEOS_VER=2.19v1.00
23+
RUN wget https://observer.gsfc.nasa.gov/ftp/edhs/hdfeos/previous_releases/HDF-EOS${HDFEOS_VER}.tar.Z; \
24+
tar zxvf HDF-EOS${HDFEOS_VER}.tar.Z; \
3225
cd hdfeos; \
3326
./configure --prefix=/usr/local/ --enable-install-include --with-hdf4=/usr/local; \
3427
make && make check && make install; \
3528
cd ..; \
36-
rm -rf /hdfeos /HDF-EOS2.19v1.00.tar.Z
29+
rm -rf /hdfeos /HDF-EOS${HDFEOS_VER}.tar.Z
3730

38-
# Build HDF5
39-
RUN wget https://observer.gsfc.nasa.gov/ftp/edhs/hdfeos5/latest_release/hdf5-1.8.19.tar.gz; \
40-
tar zxvf hdf5-1.8.19.tar.gz; \
41-
cd hdf5-1.8.19; \
31+
# Build HDF5 lib.
32+
ARG HDF5_VER=5-1.8.19
33+
RUN wget https://observer.gsfc.nasa.gov/ftp/edhs/hdfeos5/latest_release/hdf${HDF5_VER}.tar.gz; \
34+
tar zxvf hdf${HDF5_VER}.tar.gz; \
35+
cd hdf${HDF5_VER}; \
4236
./configure --prefix=/usr/local/; \
4337
make && make check && make install; \
4438
cd ..; \
45-
rm -rf /hd5f-1.8.19 /hdf5-1.8.19.tar.gz
46-
47-
# Build netCDF.
48-
RUN NETCDF_C_VERSION="4.4.1.1" \
49-
&& wget ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-${NETCDF_C_VERSION}.tar.gz -P /tmp \
50-
&& tar -xf /tmp/netcdf-${NETCDF_C_VERSION}.tar.gz -C /tmp \
51-
&& cd /tmp/netcdf-${NETCDF_C_VERSION} \
52-
&& CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib ./configure --prefix=/usr/local \
53-
&& cd /tmp/netcdf-${NETCDF_C_VERSION} \
39+
rm -rf /hdf${HDF5_VER}/hdf${HDF5_VER}.tar.gz
40+
41+
# Build netCDF C lib.
42+
ARG NETCDF_C_VER=4.4.1.1
43+
RUN wget ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-${NETCDF_C_VER}.tar.gz -P /tmp \
44+
&& tar -xf /tmp/netcdf-${NETCDF_C_VER}.tar.gz -C /tmp \
45+
&& cd /tmp/netcdf-${NETCDF_C_VER} \
46+
&& CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib LD_LIBRARY_PATH=-L/usr/local/lib ./configure --prefix=/usr/local --enable-shared \
47+
&& cd /tmp/netcdf-${NETCDF_C_VER} \
5448
&& make \
49+
&& cd /tmp/netcdf-${NETCDF_C_VER} \
5550
&& make install \
56-
&& rm -rf /tmp/netcdf-${NETCDF_C_VERSION}
51+
&& rm -rf /tmp/netcdf-${NETCDF_C_VER}
5752

5853
# Build H4CF Conversion Toolkit
59-
60-
RUN wget http://hdfeos.org/software/h4cflib/h4cflib_1.2.tar.gz; \
61-
tar zxvf h4cflib_1.2.tar.gz; \
62-
cd h4cflib_1.2; \
54+
ARG H4CF_VER=1.2
55+
RUN wget http://hdfeos.org/software/h4cflib/h4cflib_${H4CF_VER}.tar.gz; \
56+
tar zxvf h4cflib_${H4CF_VER}.tar.gz; \
57+
cd h4cflib_${H4CF_VER} \
58+
&& CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib LD_LIBRARY_PATH=-L/usr/local/lib \
6359
./configure --prefix=/usr/local/ --with-hdf4=/usr/local/ --with-hdfeos2=/usr/local/ --with-netcdf=/usr/local/; \
64-
make && make check && make install; \
60+
make && make install; \
6561
cd ..; \
66-
rm -rf /h4cflib_1.2 /hf4cflib_1.2.tar.gz
67-
62+
rm -rf /h4cflib_${H4CF_VER} /hf4cflib_${H4CF_VER}.tar.gz

README.md

+23-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
11
# docker-h4cf
22

3-
Ubuntu based Docker container for HDF4 CF Conversion Toolkit
3+
## Ubuntu based Docker container for HDF4 CF Conversion Toolkit
4+
5+
The Docker file `Dockerfile` sources an Apt package file named `apt.txt`, which lists the Apt packages required to build the image.
6+
7+
Build the image with
8+
9+
docker build -f Dockerfile \
10+
[--build-arg HDF4_VER=<HDF4 lib. version string, default 4.2.13>] \
11+
[--build-arg HDFEOS_VER=<HDFEOS lib. version string, default 2.19v1.00>] \
12+
[--build-arg HDF5_VER=<HDF5 lib. version string, default 5-1.8.19>] \
13+
[--build-arg NETCDF_C_VER=<NetCDF C lib. version string, default 4.4.1.1>] \
14+
[--build-arg H4CF_VER=<H4CF conversion toolkit version string, default 1.2>]
15+
-t <image name> .
16+
17+
The build arguments `HDF4_VER`, `HDFEOS_VER`, `HDF5_VER`, `NETCDF_C_VER`, `H4CF_VER` are optional - default versions are used within the Docker file, as indicated above.
18+
19+
Run the image in a detached container with
20+
21+
docker run --name <container name> -itd <image name>
22+
23+
Enter the container in a Bash shell with
24+
25+
docker exec -it <container name> bash

apt.txt

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
gcc
2+
build-essential
3+
curl
4+
wget
5+
bzip2
6+
tar
7+
libghc-zlib-dev
8+
libjpeg-dev
9+
gfortran
10+
bison
11+
flex
12+
file

0 commit comments

Comments
 (0)