forked from unity-sds/sounder-sips-application
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile.l1a
113 lines (90 loc) · 4.17 KB
/
Dockerfile.l1a
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
FROM unity-ads/sounder_sips_dev:r0.1.0 AS builder
# Locations of paths for building source code
ARG BUILDER_BASE_PATH=/build
ARG BUILDER_SCRIPTS_PATH=$BUILDER_BASE_PATH/scripts
ARG BUILDER_CODE_PATH=$BUILDER_BASE_PATH/src
ARG BUILDER_STATIC_DATA_PATH=/tmp/static
ARG BUILDER_STATIC_CONFIG_PATH=/pge/config
# Local file that is copied into the image then untarred
ARG CODE_SOURCE_FILE
ARG CODE_DEST_FILE=$BUILDER_BASE_PATH/sips_spss.tar.gz
USER root
# Create directories
RUN mkdir $BUILDER_BASE_PATH && \
mkdir -p $BUILDER_CODE_PATH && \
mkdir -p $BUILDER_SCRIPTS_PATH
# Copy in source code and scripts
COPY $CODE_SOURCE_FILE $CODE_DEST_FILE
COPY install/build_common.sh install/build_l1a.sh install/patch_source.sh install/create_l1a_static_config.sh ${BUILDER_SCRIPTS_PATH}/
# Build source code
RUN tar zfx $CODE_DEST_FILE --strip-components=1 -C $BUILDER_CODE_PATH && \
$BUILDER_SCRIPTS_PATH/patch_source.sh $BUILDER_CODE_PATH && \
$BUILDER_SCRIPTS_PATH/build_common.sh $BUILDER_CODE_PATH && \
$BUILDER_SCRIPTS_PATH/build_l1a.sh $BUILDER_CODE_PATH && \
$BUILDER_SCRIPTS_PATH/create_l1a_static_config.sh $BUILDER_CODE_PATH $BUILDER_STATIC_CONFIG_PATH $BUILDER_STATIC_DATA_PATH
# ---
FROM jupyter/base-notebook
# Renew usage of these values from the previous stage, these default values
# need to mirror their values in the first stage
ARG BUILDER_BASE_PATH=/build
ARG BUILDER_CODE_PATH=$BUILDER_BASE_PATH/src
ARG BUILDER_STATIC_DATA_PATH=/tmp/static
ARG BUILDER_STATIC_CONFIG_PATH=/pge/config
# There are used by the notebook to override defaults
ENV PGE_BINARY_PATH=/pge/bin
ENV PGE_INTERFACE_PATH=/pge/interface
ENV PGE_STATIC_DATA_PATH=$BUILDER_STATIC_DATA_PATH
ENV PGE_STATIC_CONFIG_PATH=$BUILDER_STATIC_CONFIG_PATH
ENV PGSHOME=/opt/packages/sdptk5.2.20v1.01/TOOLKIT/
ENV PGS_PC_INFO_FILE=${PGE_STATIC_CONFIG_PATH}/SNDR.PGSToolkit_ProcessControlFile.pcf
ENV PGS_LEAPSEC_FILE=${PGSHOME}/database/common/TD/leapsec.dat
# Switch to root for installs
USER root
# Ensure using UTF-8
RUN localedef -c -f UTF-8 -i en_US en_US.UTF-8
# Install packages required for this PGE
# These mirror much of what is in sounder_sips_dev but only contains what is necessary for runtime
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update --yes && \
apt-get install --yes --no-install-recommends \
# libturbojpeg0-dev is used by hdf4 library instead of the installed jpeg-9b version
# Even though boost is installed into /opt/packages, some of the SIPS PGEs use a system wide version
libturbojpeg libboost-dev python3-netcdf4 \
# For custom GCC
libgmpxx4ldbl libmpfi0 libmpc3 \
# Needed by netcdf libraries
libcurl4 \
# Needed by SDPTK library
csh \
# Needed by g2clib and SPSS software, contains the static library as well
libpng-dev \
# Set up papermill
python3-pip && \
pip3 install -U pip && \
pip3 install papermill && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# Create directory structure for PGE files and necessary files
RUN mkdir -p $PGE_BINARY_PATH && \
mkdir -p $PGE_STATIC_CONFIG_PATH && \
mkdir -p $PGE_INTERFACE_PATH && \
mkdir -p /opt/packages
# Copy L1A PGE binary from build
COPY --from=builder $BUILDER_CODE_PATH/src/sips_pge/l1a_atms/pge/bin/L1AMw_main $PGE_BINARY_PATH
# Copy MetExtractor binary from build
COPY --from=builder $BUILDER_CODE_PATH/src/scf_metextractors/main/bin/MetExtractor $PGE_BINARY_PATH
# Copy PGE interface notebook
COPY interface/run_l1a_pge.ipynb $PGE_INTERFACE_PATH
# Copy over SDP Toolkit for its database files
COPY --from=builder /opt/packages/sdptk5.2.20v1.01 /opt/packages/sdptk5.2.20v1.01
# Copy over static config files
COPY --from=builder $BUILDER_STATIC_CONFIG_PATH $PGE_STATIC_CONFIG_PATH
# Necessary for click framework used by papermill:
# https://click.palletsprojects.com/en/8.0.x/unicode-support/
ENV LANG=C.UTF-8
ENV LC_ALL=en_US.UTF-8
# Switch back to jovyan to avoid accidental container runs as root
USER ${NB_UID}
# Make sure that $PGE_INTERFACE_PATH and this path match.
# We cannot evaluate variables inside the exec form of ENTRYPOINT,
# So the path must be duplicated here in order to work.
ENTRYPOINT ["papermill", "/pge/interface/run_l1a_pge.ipynb"]