Skip to content

Commit caf2546

Browse files
committed
Cursory rework of testing environment image.
1 parent 27231a0 commit caf2546

File tree

5 files changed

+43
-96
lines changed

5 files changed

+43
-96
lines changed

.circleci/.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!requirements-conda.txt

.circleci/Dockerfile

Lines changed: 18 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,33 @@
1-
FROM circleci/openjdk:8-jdk
2-
3-
ENV MINICONDA_VERSION=4.8.2 \
4-
MINICONDA_MD5=87e77f097f6ebb5127c77662dfc3165e \
5-
CONDA_VERSION=4.8.2 \
6-
CONDA_DIR=/opt/conda \
7-
PYTHON_VERSION=3.7.7
1+
FROM circleci/openjdk:11-jdk
2+
#LABEL org.opencontainers.image.source=https://github.com/locationtech/rasterframes
83

94
USER root
105

11-
ENV PATH=$CONDA_DIR/bin:$PATH
12-
13-
# circleci is 3434
14-
COPY --chown=3434:3434 fix-permissions /tmp
15-
6+
# See: https://docs.conda.io/projects/conda/en/latest/user-guide/install/rpm-debian.html
167
RUN \
17-
apt-get update && \
18-
apt-get install -yq --no-install-recommends \
19-
sudo \
20-
wget \
21-
bzip2 \
22-
file \
23-
libtinfo5 \
24-
ca-certificates \
25-
gettext-base \
26-
locales && \
27-
apt-get clean && \
28-
rm -rf /var/lib/apt/lists/*
8+
curl -s https://repo.anaconda.com/pkgs/misc/gpgkeys/anaconda.asc | gpg --dearmor > conda.gpg && \
9+
install -o root -g root -m 644 conda.gpg /usr/share/keyrings/conda-archive-keyring.gpg && \
10+
gpg --keyring /usr/share/keyrings/conda-archive-keyring.gpg --no-default-keyring --fingerprint 34161F5BF5EB1D4BFBBB8F0A8AEB4F8B29D82806 && \
11+
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/conda-archive-keyring.gpg] https://repo.anaconda.com/pkgs/misc/debrepo/conda stable main" > /etc/apt/sources.list.d/conda.list
2912

3013
RUN \
31-
cd /tmp && \
32-
mkdir -p $CONDA_DIR && \
33-
wget --quiet https://repo.continuum.io/miniconda/Miniconda3-py37_${MINICONDA_VERSION}-Linux-x86_64.sh && \
34-
echo "${MINICONDA_MD5} *Miniconda3-py37_${MINICONDA_VERSION}-Linux-x86_64.sh" | md5sum -c - && \
35-
/bin/bash Miniconda3-py37_${MINICONDA_VERSION}-Linux-x86_64.sh -f -b -p $CONDA_DIR && \
36-
rm Miniconda3-py37_${MINICONDA_VERSION}-Linux-x86_64.sh && \
37-
conda config --system --set auto_update_conda false && \
38-
conda config --system --set show_channel_urls true && \
39-
conda config --system --set channel_priority strict && \
40-
if [ ! $PYTHON_VERSION = 'default' ]; then conda install --yes python=$PYTHON_VERSION; fi && \
41-
conda list python | grep '^python ' | tr -s ' ' | cut -d '.' -f 1,2 | sed 's/$/.*/' >> $CONDA_DIR/conda-meta/pinned && \
42-
conda install --quiet --yes conda && \
43-
conda install --quiet --yes pip && \
44-
pip config set global.progress_bar off && \
45-
echo "$CONDA_DIR/lib" > /etc/ld.so.conf.d/conda.conf && \
46-
conda clean --all --force-pkgs-dirs --yes --quiet && \
47-
sh /tmp/fix-permissions $CONDA_DIR 2> /dev/null
14+
apt-get update && \
15+
apt-get install -yq --no-install-recommends conda && \
16+
apt-get clean && \
17+
rm -rf /var/lib/apt/lists/*
4818

49-
COPY requirements-conda.txt /tmp/
19+
ENV CONDA_DIR=/opt/conda
20+
ENV PATH=$CONDA_DIR/bin:$PATH
5021

22+
COPY requirements-conda.txt /tmp
5123
RUN \
52-
conda install --channel conda-forge --no-channel-priority --freeze-installed \
53-
--file /tmp/requirements-conda.txt && \
54-
conda clean --all --force-pkgs-dirs --yes --quiet && \
55-
sh /tmp/fix-permissions $CONDA_DIR 2> /dev/null && \
56-
ldconfig 2> /dev/null
24+
conda install --quiet --yes --channel=conda-forge --file=/tmp/requirements-conda.txt && \
25+
echo "$CONDA_DIR/lib" > /etc/ld.so.conf.d/conda.conf && \
26+
ldconfig && \
27+
conda clean --all --force-pkgs-dirs --yes --quiet
5728

5829
# Work-around for pyproj issue https://github.com/pyproj4/pyproj/issues/415
5930
ENV PROJ_LIB=/opt/conda/share/proj
6031

6132
USER 3434
62-
6333
WORKDIR /home/circleci

.circleci/Makefile

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
1-
IMAGE_NAME=miniconda-gdal
2-
VERSION=latest
1+
IMAGE_NAME=circleci-openjdk-conda-gdal
2+
SHA=$(shell git log -n1 --format=format:"%H" | cut -c 1-7)
3+
VERSION?=$(SHA)
34
HOST=docker.pkg.github.com
4-
REPO=${HOST}/locationtech/rasterframes
5-
FULL_NAME=${REPO}/${IMAGE_NAME}:${VERSION}
5+
REPO=$(HOST)/locationtech/rasterframes
6+
FULL_NAME=$(REPO)/$(IMAGE_NAME):$(VERSION)
7+
GIT_USER?=metasim
8+
KEY?=$(HOME)/.github/repo-publish-key.txt
69

7-
all: build login push
10+
.DEFAULT_GOAL := help
11+
help:
12+
# http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
13+
@echo "Usage: make [target]"
14+
@echo "Targets: "
15+
@grep -E '^[a-zA-Z0-9_%/-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\t\033[36m%-20s\033[0m %s\n", $$1, $$2}'
816

9-
build:
17+
all: build push ## Build and then push image
18+
19+
build: ## Build the docker image
1020
docker build . -t ${FULL_NAME}
1121

12-
login:
13-
docker login ${HOST}
22+
login: ## Login to the docker registry
23+
cat $(KEY) | docker login $(HOST) -u $(GIT_USER) --password-stdin
1424

15-
push:
25+
push: login ## Push docker image to registry
1626
docker push ${FULL_NAME}
1727

18-
shell: build
28+
run: build ## Build image and launch shell
1929
docker run --rm -it ${FULL_NAME} bash

.circleci/fix-permissions

Lines changed: 0 additions & 37 deletions
This file was deleted.

.circleci/requirements-conda.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
gdal==2.4.4
1+
python==3.8
2+
gdal==3.1.2
23
libspatialindex
4+
rasterio[s3]
35
rtree

0 commit comments

Comments
 (0)