diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..02aa2da --- /dev/null +++ b/Dockerfile @@ -0,0 +1,48 @@ +ARG DISTRO_IMAGE=ubuntu +ARG DISTRO_IMAGE_VERSION=20.04 +FROM $DISTRO_IMAGE:$DISTRO_IMAGE_VERSION + +ENV DEBIAN_FRONTEND=noninteractive +ENV DEBIAN_PRIORITY=critical +RUN apt-get update && \ + apt-get install -y \ +# general deps \ + curl \ + build-essential \ + make \ + gcc \ +# jasper deps \ + cmake \ + automake \ + autoconf \ + libtool \ + m4 \ + pkg-config \ +# hlrdas deps \ + libswitch-perl \ + gfortran \ + libnetcdf-dev \ +# comment libnetcdff-dev to build in 14.04 only available in newer releases \ + libnetcdff-dev \ + libjpeg-dev \ + libjpeg-turbo8-dev \ + libbz2-dev \ + libgrib2c-dev \ + && apt-get clean + +RUN apt install -y \ + git + +VOLUME /src +WORKDIR /tmp +RUN curl -L https://github.com/mdadams/jasper/archive/version-1.900.31.tar.gz | tar xvz && \ + cd jasper* && \ + autoreconf -i && \ + ./configure --prefix /usr && \ + make install && \ + rm -rf /tmp/jasper* + +WORKDIR /src + +COPY entrypoint.sh / +ENTRYPOINT /entrypoint.sh diff --git a/README.md b/README.md index 1573edc..e55385c 100644 --- a/README.md +++ b/README.md @@ -7,3 +7,16 @@ Repository branch structure (as of July 27, 2018) master: this is the base branch and contains all finalized development before WRF release release: branch from master at WRF release intervals; may include important bug fixes after release + +Build default Ubuntu 20.04 container with all dependencies: + docker build -t hrldas:latest . + +Run default Ubuntu 20.04 container to compile with: + docker run -it --rm --mount type=bind,source=$(pwd),target=/src -w /src/HRLDAS hrldas:latest + +Build specific container with: + export DISTRO_IMAGE=ubuntu DISTRO_IMAGE_VERSION=16.04; docker build --build-arg DISTRO_IMAGE=$DISTRO_IMAGE --build-arg DISTRO_IMAGE_VERSION=$DISTRO_IMAGE_VERSION -t hrldas:$DISTRO_IMAGE-$DISTRO_IMAGE_VERSION -t hrldas:latest . + +Run specific Ubuntu/Debian container to compile with: + export DISTRO_IMAGE=ubuntu DISTRO_IMAGE_VERSION=16.04 + docker run -it --rm --mount type=bind,source=$(pwd),target=/src -w /src/HRLDAS hrldas:$DISTRO_IMAGE-$DISTRO_IMAGE_VERSION diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..b810bc4 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,4 @@ +#/bin/sh +sed -E -e's%/opt/local%/usr%g' -e'/COMPILERF90/s%(=\s+).*%\1gfortran%' -e'/CPP\s/s%(=\s+).*%\1cpp%' -e'/CC\s/s%(=\s+).*%\1gcc%' -e's/-fno-underscoring//' arch/user_build_options.gfortran.serial > ./user_build_options + +make clean all