-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
87 lines (54 loc) · 2.01 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
# syntax=docker/dockerfile:1.4.2
FROM ghcr.io/uomresearchit/wrf-libraries:latest
RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y \
python3
###############################################################################
## Set directory variables
ARG EMEP_SOURCES=/EMEP-SOURCES
WORKDIR $EMEP_SOURCES
###############################################################################
## Download catalog tool and get source code
ARG TARGET_URL=https://raw.githubusercontent.com/metno/emep-ctm/tools/catalog.py
ARG EMEP_VERSION=rv4_45
RUN <<EOF_CODE
# download the catalog tool
wget $TARGET_URL
# download the source code for rv4_45 release
printf 'y\nn\n' | python3 ./catalog.py -R rv4_45 --source
EOF_CODE
WORKDIR $EMEP_SOURCES/emep-ctm-$EMEP_VERSION
###############################################################################
## Compile EMEP using edited makefile
RUN <<EOF_COMPILE
## Edit source code to compily with gfortran expectations for specified width formatting
sed -i 's/(a,i,a,3i3,50f8.2)/(a,i3,a,3i3,50f8.2)/g' EmisGet_mod.f90
## << Create makefile
cat <<EOF_MAKEFILE > Makefile.docker
PROG = emepctm
include Makefile.SRCS
LIBS = -lnetcdff -lnetcdf
INCL = \$(nf-config --fflags)
LLIB = \$(nf-config --flibs)
F90 = mpif90
F90FLAGS = -ffree-line-length-none -fdefault-real-8 -O2
LDFLAGS = \$(F90FLAGS) \$(LLIB) -o \$(PROG) \$(FOBJ) \$(INCL) \$(LIBS)
.SUFFIXES: \$(SUFFIXES) .f90
.f90.o:
\$(F90) \$(F90FLAGS) \$(INCL) -c \$<
all: \$(PROG)
include dependencies
\$(PROG): \$(FOBJ)
\$(F90) \$(LDFLAGS)
## >> Finish creating makefile
##########################################################
EOF_MAKEFILE
make -f Makefile.docker all
# Move executable, and delete install directory
mv emepctm /usr/local/bin/
cd /
rm -rf /EMEP-SOURCES
EOF_COMPILE
WORKDIR /
LABEL version.emep=rv4_45
LABEL org.opencontainers.image.description="EMEP Chemistry Transport Model"
LABEL org.opencontainers.image.source="https://github.com/UoMResearchIT/EMEP-docker"