Commit 0b1be982 authored by R.K.Garcia's avatar R.K.Garcia
Browse files

WIP cris-l1b-ru utility in docker container

parent 7309bb02
Pipeline #36561 failed with stage
in 16 minutes and 9 seconds
*.nc filter=lfs diff=lfs merge=lfs -text
*.mat filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
# Build a Docker image with CI/CD and push to the GitLab registry.
# ref: https://docs.gitlab.com/ee/ci/docker/using_kaniko.html
# Define environment variables for all stages
variables:
GIT_SUBMODULE_STRATEGY: normal
GIT_DEPTH: 1
# additional path in image name, optional (leave empty if not desired)
IMAGE_PATH: ""
docker-build:
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
tags:
- docker
- ssec_shared
stage: build
before_script:
- |
mkdir -p /kaniko/.docker
echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
# Default branch leaves tag empty (= latest tag)
# All other branches are tagged with the escaped branch name (commit ref slug)
script:
- |
revid=:g${CI_COMMIT_SHA:0:10}
if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
tag=""
echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'"
else
# tag=":$CI_COMMIT_REF_SLUG"
IMAGE_PATH="$IMAGE_PATH/$CI_COMMIT_REF_SLUG"
tag=""
echo "Running on branch '$CI_COMMIT_BRANCH': image = $IMAGE_PATH"
fi
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --push-retry 4 --destination "${CI_REGISTRY_IMAGE}${IMAGE_PATH}${tag}" --destination "${CI_REGISTRY_IMAGE}${IMAGE_PATH}${revid}"
# Run this job in a branch where a Dockerfile exists
rules:
- if: $CI_COMMIT_BRANCH
exists:
- Dockerfile
FROM gitlab.ssec.wisc.edu:5555/cris_l1b/glue/buildbucket:r20200324 as matlab
RUN mkdir -p /opt /work
COPY RU /opt/RU
RUN cd /opt/RU \
&& mcc -m cris_gran_RU_ncparam.m
RUN mkdir /work/mcr \
&& cd /work/mcr \
&& curl -sSO https://ssd.mathworks.com/supportfiles/downloads/R2014b/deployment_files/R2014b/installers/glnxa64/MCR_R2014b_glnxa64_installer.zip \
&& unzip MCR_R2014b_glnxa64_installer.zip \
&& mkdir /opt/mcr \
&& ./install -mode silent -agreeToLicense yes -destinationFolder /opt/mcr
FROM centos:7 as shell
RUN yum -y install libXext libXt
ENV RU_HOME=/opt/RU
ENV MCRROOT=/opt/mcr/v84
COPY --from=matlab /opt /opt
RUN ln -s /opt/RU/cris-l1b-ru /usr/local/bin/
ENTRYPOINT ["/opt/RU/cris-l1b-ru"]
#!/bin/bash -e
usagexit() {
echo >&2 "usage: cris-l1b-ru {SNPP,J1} L1B-FILENAME RU-FILENAME"
echo >&2 "docker usage: docker run --rm -v\$PWD:\$PWD -w\$PWD gitlab.ssec.wisc.edu:5555/cris_l1b/user cris-l1b-ru {SNPP,J1} L1B-FILENAME RU-FILENAME"
exit 1
}
abspath() {
python -c 'import sys,os; print("\n".join([os.path.abspath(x) for x in sys.argv[1:]]))' "$@"
}
test -d "$RU_HOME" || echo >&2 "${Oops:?RU_HOME is not set}"
test -d "$MCRROOT" || echo >&2 "${Oops:?MCRROOT must point to Matlab runtime}"
SAT="$1"
INPUT_FILE="$(abspath "$2")"
OUTPUT_FILE="$3"
test -n "$SAT" || usagexit
test -f "$INPUT_FILE" || usagexit
test -n "$OUTPUT_FILE" || usagexit
export MATLABPATH="$RU_HOME"
# always limit the blast radius of LD_LIBRARY_PATH to as small a space as possible
export LD_LIBRARY_PATH="$MCRROOT/runtime/glnxa64:$MCRROOT/bin/glnxa64:$MCRROOT/sys/os/glnxa64"
exec "$RU_HOME/run_cris_gran_RU_ncparam_wrapper.sh" "$MCRROOT" "$SAT" "$INPUT_FILE" "1" "$OUTPUT_FILE"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment