Skip to content
This repository was archived by the owner on Jun 17, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Docker Image CI

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:

build:

runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v4
- name: Build the Docker image
run: docker build . --file Dockerfile --tag hdf-h4cf-test:$(date +%s)
92 changes: 47 additions & 45 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,64 +1,66 @@
FROM ubuntu:latest
FROM ubuntu:18.04

MAINTAINER The HDF-EOS Tools and Information Center <eoshelp@hdfgroup.org>

ENV HOME /root

COPY ["./apt.txt", "./"]

ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Etc/UTC
RUN apt update && apt install -yq $(grep -vE "^\s*#" ./apt.txt)

#Build HDF4 lib.
ARG HDF4_VER=4.2.13
RUN wget https://observer.gsfc.nasa.gov/ftp/edhs/hdfeos/latest_release/hdf-${HDF4_VER}.tar.gz; \
tar zxvf hdf-${HDF4_VER}.tar.gz; \
cd hdf-${HDF4_VER}; \
./configure --prefix=/usr/local/ --disable-netcdf; \
make && make check && make install; \
cd ..; \
rm -rf /hdf-${HDF4_VER} /hdf-${HDF4_VER}.tar.gz
ARG HDF4_VER=4.2.16
RUN wget https://hdf-wordpress-1.s3.amazonaws.com/wp-content/uploads/manual/HDF4/HDF${HDF4_VER}-2/src/hdf-${HDF4_VER}-2.tar.gz && \
tar zxvf hdf-${HDF4_VER}-2.tar.gz && \
cd hdf-${HDF4_VER}-2 && \
./configure --prefix=/usr/local/ --enable-shared --disable-netcdf --disable-fortran && \
make && make check && make install && \
cd .. && \
rm -f hdf-${HDF4_VER}-2.tar.gz

#Build HDF-EOS2 lib.
ARG HDFEOS_VER=2.19v1.00
RUN wget https://observer.gsfc.nasa.gov/ftp/edhs/hdfeos/previous_releases/HDF-EOS${HDFEOS_VER}.tar.Z; \
tar zxvf HDF-EOS${HDFEOS_VER}.tar.Z; \
cd hdfeos; \
./configure --prefix=/usr/local/ --enable-install-include --with-hdf4=/usr/local; \
make && make check && make install; \
cd ..; \
rm -rf /hdfeos /HDF-EOS${HDFEOS_VER}.tar.Z
ARG HDFEOS2_VER=2.20v1.00
RUN wget -O hdf-eos${HDFEOS2_VER}.tar.Z https://git.earthdata.nasa.gov/rest/git-lfs/storage/DAS/hdfeos/cb0f900d2732ab01e51284d6c9e90d0e852d61bba9bce3b43af0430ab5414903?response-content-disposition=attachment%3B%20filename%3D%22HDF-EOS${HDFEOS_VER}.tar.Z%22%3B%20filename*%3Dutf-8%27%27HDF-EOS2.20v1.00.tar.Z && \
tar zxvf hdf-eos${HDFEOS2_VER}.tar.Z && \
cd hdfeos && \
./configure --prefix=/usr/local/ --enable-install-include --with-hdf4=/usr/local && \
make && make check && make install && \
cd .. && \
rm -f hdf-eos${HDFEOS2_VER}.tar.Z

# Build HDF5 lib.
ARG HDF5_VER=5-1.8.19
RUN wget https://observer.gsfc.nasa.gov/ftp/edhs/hdfeos5/latest_release/hdf${HDF5_VER}.tar.gz; \
tar zxvf hdf${HDF5_VER}.tar.gz; \
cd hdf${HDF5_VER}; \
./configure --prefix=/usr/local/; \
make && make check && make install; \
cd ..; \
rm -rf /hdf${HDF5_VER}/hdf${HDF5_VER}.tar.gz
ARG HDF5_VER=1.14.4-2
ARG HDF5_DOTVER=1.14.4.2
RUN wget https://github.com/HDFGroup/hdf5/releases/download/hdf5_${HDF5_DOTVER}/hdf5-${HDF5_VER}.tar.gz && \
tar zxvf hdf5-${HDF5_VER}.tar.gz && \
cd hdf5-${HDF5_VER} && \
./configure --prefix=/usr/local/ && \
make && make check && make install && \
cd .. && \
rm -f hdf5-${HDF5_VER}.tar.gz

# Build netCDF C lib.
ARG NETCDF_C_VER=4.4.1.1
RUN wget ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-${NETCDF_C_VER}.tar.gz -P /tmp \
&& tar -xf /tmp/netcdf-${NETCDF_C_VER}.tar.gz -C /tmp \
&& cd /tmp/netcdf-${NETCDF_C_VER} \
&& CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib LD_LIBRARY_PATH=-L/usr/local/lib ./configure --prefix=/usr/local --enable-shared \
&& cd /tmp/netcdf-${NETCDF_C_VER} \
&& make \
&& cd /tmp/netcdf-${NETCDF_C_VER} \
&& make install \
&& rm -rf /tmp/netcdf-${NETCDF_C_VER}.tar.gz
ARG NETCDF_C_VER=4.9.2
RUN wget https://github.com/Unidata/netcdf-c/archive/refs/tags/v${NETCDF_C_VER}.tar.gz && \
tar zxvf v${NETCDF_C_VER}.tar.gz && \
cd netcdf-c-${NETCDF_C_VER} && \
CPPFLAGS="-Ihdf5-${HDF5_VER}/include -Ihdf-${HDF4_VER}-2/include" \
LDFLAGS="-Lhdf5-${HDF5_VER}/lib -Lhdf-${HDF4_VER}-2/lib" && \
./configure --prefix=/usr/local --disable-byterange --enable-shared --enable-hdf4 --enable-hdf4-file-tests && \
make && make check && make install && \
cd .. && rm -rf netcdf-c-${NETCDF_C_VER} && rm -f v${NETCDF_C_VER}.tar.gz

# Build H4CF Conversion Toolkit
ARG H4CF_VER=1.2
RUN wget http://hdfeos.org/software/h4cflib/h4cflib_${H4CF_VER}.tar.gz; \
tar zxvf h4cflib_${H4CF_VER}.tar.gz; \
cd h4cflib_${H4CF_VER} \
&& CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib LD_LIBRARY_PATH=-L/usr/local/lib \
./configure --prefix=/usr/local/ --with-hdf4=/usr/local/ --with-hdfeos2=/usr/local/ --with-netcdf=/usr/local/; \
make && make install; \
cd ..; \
rm -rf /h4cflib_${H4CF_VER} /hf4cflib_${H4CF_VER}.tar.gz
ARG H4CF_VER=1.3
RUN wget http://hdfeos.org/software/h4cflib/h4cflib_${H4CF_VER}.tar.gz && \
tar zxvf h4cflib_${H4CF_VER}.tar.gz && \
cd h4cflib_${H4CF_VER} && \
CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib LD_LIBRARY_PATH=-L/usr/local/lib && \
./configure --with-hdf4=hdf-${HDF4_VER}-2 --with-hdfeos2=hdfeos --with-netcdf=hdf5-${HDF5_VER} && \
make && make install && \
cd .. && \
rm -f hf4cflib_${H4CF_VER}.tar.gz

ENV LD_LIBRARY_PATH /usr/local/lib
ENV LD_LIBRARY_PATH /usr/local/lib
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# docker-h4cf

## Ubuntu based Docker container for HDF4 CF Conversion Toolkit
## Ubuntu Docker image for HDF4 CF Conversion Toolkit

The Docker file `Dockerfile` sources an Apt package file named `apt.txt`, which lists the Apt packages required to build the image.

Expand Down
1 change: 1 addition & 0 deletions apt.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ bzip2
tar
libghc-zlib-dev
libjpeg-dev
libxml2-dev
gfortran
bison
flex
Expand Down