From 24aa468275e46d6ea4810114488f2e7e49c3c632 Mon Sep 17 00:00:00 2001 From: Paolo Veglio <paolo.veglio@ssec.wisc.edu> Date: Mon, 29 Apr 2024 14:55:36 +0000 Subject: [PATCH] new docker container for CI --- .gitlab-ci.yml | 37 ++++++++++++++++++++++++++++--------- ci/Dockerfile | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+), 9 deletions(-) create mode 100644 ci/Dockerfile diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e7b4472..b61d5dd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,21 +1,40 @@ -stages: - - test +variables: + DOCKER_TLS_CERTDIR: "" + DOCKER_HOST: "tcp://docker:2375" -default: - image: python:3.10 +ci: + stage: .pre + image: docker:19.03.1 tags: - ssec_shared - before_script: - - python --version # For debugging - - pip install hatch pytest + services: + - docker:19.03.1-dind + script: + - docker login --username $CI_REGISTRY_USER --password $CI_REGISTRY_PASSWORD $CI_REGISTRY + - cd ci + - docker build --tag $CI_REGISTRY_IMAGE . + - docker push $CI_REGISTRY_IMAGE + rules: + - changes: + - ci/Dockerfile + when: always + +# build: +# stage: build +# tags: +# - ssec_shared +# image: $CI_REGISTRY_IMAGE +# script: +# - +# test: tags: - ssec_shared script: - python --version - - pip install -e . - - python setup.py build_ext --inplace + # - pip install -e . + # - python setup.py build_ext --inplace - pytest tests/test_conf.py - pytest tests/test_read_data.py::test_sst - pytest tests/test_read_data.py::test_ndvi diff --git a/ci/Dockerfile b/ci/Dockerfile new file mode 100644 index 0000000..64d7043 --- /dev/null +++ b/ci/Dockerfile @@ -0,0 +1,50 @@ +FROM rockylinux/rockylinux:8 + +# Setup basic stuff +RUN dnf -y install epel-release +RUN dnf -y install gcc \ + gcc-c++ \ + wget \ + bzip2 \ + make \ + libjpeg-turbo-devel \ + zlib-devel \ + libtirpc-devel \ + hdf \ + hdf-devel \ + git + +# Build szip +RUN wget https://support.hdfgroup.org/ftp/lib-external/szip/2.1.1/src/szip-2.1.1.tar.gz; \ + tar zxf szip-2.1.tar.gz; \ + cd szip-2.1; \ + ./configure --prefix=/usr/local; \ + make && make install; \ + cd ..; \ + rm -rf /szip-2.1 /szip-2.1.tar.gz + +#Build HDF-EOS2 +RUN wget ftp://ftp.ssec.wisc.edu/pub/pveglio/HDFEOS/HDF-EOS2.20v1.00.tar.Z; \ + tar zxf HDF-EOS2.20v1.00.tar.Z; \ + cd hdfeos; \ + ./configure --prefix=/usr/local/ --enable-install-include CPPFLAGS=-I/usr/include/hdf --with-szip=/usr/local; \ + make && make install; \ + cd ..; \ + rm -rf /hdfeos /HDF-EOS2.20v1.00.tar.Z + +# add powertools to be able to install netcdf +RUN dnf config-manager --set-enabled powertools +RUN dnf -y install netcdf-devel + +# get micromamba +RUN wget -qO- https://micromamba.snakepit.net/api/micromamba/linux-64/latest | tar -xvj bin/micromamba + +# create env +RUN micromamba create -yn mvcm python=3.10 -c conda-forge +ARG mambaenv="/root/micromamba/envs/mvcm/bin" + +# clone repo and install MVCM, then compile cython +RUN git clone https://citest:glpat-UQmZwC8KhWwtx6PyA7LJ@gitlab.ssec.wisc.edu/pveglio/mvcm.git +WORKDIR mvcm +RUN ${mambaenv}/pip install -e . +RUN ${mambaenv}/python setup.py build_ext --inplace -- GitLab