Skip to content

Commit 781bcc6

Browse files
committed
Consolidate dockerfile RUN commands to shrink container size
1 parent f0d97a2 commit 781bcc6

File tree

2 files changed

+14
-21
lines changed

2 files changed

+14
-21
lines changed

.github/workflows/ci_docker.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,20 @@ jobs:
2424
with:
2525
username: ${{ secrets.DOCKERHUB_USERNAME }}
2626
password: ${{ secrets.DOCKERHUB_TOKEN }}
27-
- name: Build and export test tag to Docker
27+
- name: Build and export test tag
2828
uses: docker/build-push-action@v5
2929
with:
3030
context: .
3131
file: docker/Dockerfile
3232
load: true
3333
tags: ${{ env.TEST_TAG }}
34-
- name: Test and push latest tag
34+
- name: Test
3535
run: |
3636
docker pull ${{ env.TEST_TAG }}
3737
mkdir $HOME/output
3838
chmod a+rw $HOME/output
3939
docker run --rm -v $HOME/output:/home ${{ env.TEST_TAG }} ./run_scm.py -f ../../test/rt_test_cases.py --runtime_mult 0.1 -d
40-
- name: Build and push
40+
- name: Push latest tag
4141
uses: docker/build-push-action@v5
4242
with:
4343
context: .

docker/Dockerfile

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ MAINTAINER Michael Kavulich <kavulich@ucar.edu>
66
RUN apt-get -y update
77

88
# Get "essential" tools and libraries
9-
RUN apt-get -y install build-essential
10-
RUN apt-get -y install cmake curl git file gfortran-12 ksh m4 python3 tcsh time wget vim
11-
RUN apt-get -y install libnetcdf-pnetcdf-19 libnetcdff7 libnetcdf-dev libnetcdff-dev libxml2
12-
RUN apt-get -y install python3-pip python3.11-venv
9+
RUN apt-get -y install build-essential \
10+
&& apt-get -y install cmake curl git file gfortran-12 ksh m4 python3 tcsh time wget vim \
11+
&& apt-get -y install libnetcdf-pnetcdf-19 libnetcdff7 libnetcdf-dev libnetcdff-dev libxml2 \
12+
&& apt-get -y install python3-pip python3.11-venv
1313

1414
MAINTAINER Grant Firl <grantf@ucar.edu> or Michael Kavulich <kavulich@ucar.edu>
1515

@@ -69,24 +69,17 @@ RUN cd $NCEPLIBS_DIR/src \
6969
&& make VERBOSE=1 \
7070
&& make install
7171

72-
# Obtain CCPP SCM source code
73-
RUN cd /comsoftware \
74-
&& git clone --recursive -b main https://github.com/NCAR/ccpp-scm
75-
76-
# Obtain static data that was previously stored in repository
77-
RUN cd /comsoftware/ccpp-scm/ \
78-
&& ./contrib/get_all_static_data.sh
79-
80-
# Obtain the pre-computed look-up tables for running with Thompson microphysics
81-
RUN cd /comsoftware/ccpp-scm/ \
82-
&& ./contrib/get_thompson_tables.sh
83-
8472
ENV bacio_ROOT /comsoftware/nceplibs
8573
ENV sp_ROOT /comsoftware/nceplibs
8674
ENV w3emc_ROOT /comsoftware/nceplibs
8775

88-
# Invoke cmake on the source code to build
89-
RUN cd /comsoftware/ccpp-scm/scm \
76+
# Obtain CCPP SCM source code and static data, build code
77+
RUN cd /comsoftware \
78+
&& git clone --recursive -b main https://github.com/NCAR/ccpp-scm \
79+
&& cd /comsoftware/ccpp-scm/ \
80+
&& ./contrib/get_all_static_data.sh \
81+
&& ./contrib/get_thompson_tables.sh \
82+
&& cd /comsoftware/ccpp-scm/scm \
9083
&& mkdir bin \
9184
&& cd bin \
9285
&& cmake ../src \

0 commit comments

Comments
 (0)