Commit f6d768d9 authored by René Fritze's avatar René Fritze Committed by René Fritze

rewire local docker infra to match pypi mirror on gitlab ci

parent 77910a8a
......@@ -4,6 +4,7 @@
# if you want to use the local dev setup, see docker/docker-compose.yml
ARG BASE=pymor/testing_py3.7:latest
ARG BUILD_ENV=binder
ARG PYPI_MIRROR_TAG=latest
FROM $BASE as image_binder
ONBUILD ADD . /pymor
......@@ -12,6 +13,8 @@ FROM $BASE as image_dev
ONBUILD RUN echo "dev image uses mounted pymor" && mkdir /pymor
ONBUILD ENV PYTHONPATH=/pymor/src:${PYTHONPATH}
FROM pymor/pypi-mirror_stable_py3.7:${PYPI_MIRROR_TAG} as dependencies
# select "base" image according to build arg
FROM image_${BUILD_ENV}
MAINTAINER rene.fritze@wwu.de
......@@ -33,12 +36,12 @@ RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \
COPY .binder/local_packages /pymor/local_packages/
RUN for i in $(find /pymor/local_packages -maxdepth 1 -mindepth 1 -type d | grep -v keepdir) ; do pip install -e $i ; done
COPY --from=dependencies /pymor/downloads/* /tmp/dependencies/
RUN pip install /tmp/dependencies/*
# at this point setup.py exists only in image_binder
# for the dev image it's only available via the mount at runtime
ADD requirements*.txt /tmp/
RUN /bin/bash -c "pip install jupyterlab && \
pip install -r /tmp/requirements-optional.txt && \
jupyter nbextension install --py --symlink --sys-prefix pythreejs && \
jupyter nbextension enable --py --sys-prefix pythreejs && \
jupyter labextension install jupyter-threejs && \
......
version: '3'
# you should not use this file directly, but rather via the targets in ../Makefile
# this service runs a jupyter notebook server with all of pymor's
# requirements installed and the src directory added to PYTHONPATH
......@@ -17,8 +19,9 @@ services:
context: ../
dockerfile: .binder/Dockerfile
args:
BASE: pymor/testing_py3.7:05486aa0fe225e7aac9cc32eb5bcbeb73339a500
BASE: pymor/testing_py3.7:${CI_IMAGE_TAG}
PYMOR_JUPYTER_TOKEN: "${PYMOR_JUPYTER_TOKEN}"
PYPI_MIRROR_TAG: ${PYPI_MIRROR_TAG}
NB_USER: "${USER}"
NB_UID: 1000
BUILD_ENV: dev
......@@ -38,7 +41,13 @@ services:
bash -c "jupyter notebook --ip 0.0.0.0 --no-browser --notebook-dir=$${NB_DIR} --NotebookApp.disable_check_xsrf=True"
pytest:
image: pymor/testing_py3.7:05486aa0fe225e7aac9cc32eb5bcbeb73339a500
build:
context: ../
dockerfile: .binder/local-dev.Dockerfile
args:
BASE: pymor/testing_py3.7:${CI_IMAGE_TAG}
PYPI_MIRROR_TAG: ${PYPI_MIRROR_TAG}
image: pymor_local_dev
environment:
- PYMOR_PYTEST_MARKER=${PYMOR_PYTEST_MARKER}
- CI_PROJECT_DIR=/src
......@@ -48,7 +57,9 @@ services:
command: "/src/.ci/gitlab/script.bash"
docs:
image: pymor/testing:3.7
image: pymor_local_dev
depends_on:
- pytest
environment:
- PYMOR_FORCE_JUPYTER=1
- PYMOR_WITH_SPHINX=1
......@@ -56,4 +67,4 @@ services:
volumes:
- ./..:/src
restart: "no"
command: "/src/.ci/gitlab/test_docs.bash"
\ No newline at end of file
command: "/src/.ci/gitlab/test_docs.bash"
# the docker container for local dev just needs to pypi-mirror dependencies baked in
ARG PYPI_MIRROR_TAG=latest
ARG BASE=pymor/testing_py3.7:latest
FROM pymor/pypi-mirror_stable_py3.7:${PYPI_MIRROR_TAG} as dependencies
FROM ${BASE}
MAINTAINER rene.fritze@wwu.de
COPY --from=dependencies /pymor/downloads/* /tmp/dependencies/
RUN pip install /tmp/dependencies/*
......@@ -5,6 +5,8 @@ PANDOC_MAJOR=$(shell pandoc --version | head -n1 | cut -d ' ' -f 2 | cut -d '.'
ifeq ($(PANDOC_MAJOR),1)
PANDOC_FORMAT=-f markdown_github
endif
PYPI_MIRROR_TAG:=$(shell cat .ci/PYPI_MIRROR_TAG)
CI_IMAGE_TAG:=$(shell cat .ci/CI_IMAGE_TAG)
.PHONY: docker README.html pylint test docs
......@@ -53,9 +55,9 @@ docs:
# Docker targets
docker_image:
$(DOCKER_COMPOSE) build
PYPI_MIRROR_TAG=$(PYPI_MIRROR_TAG) CI_IMAGE_TAG=$(CI_IMAGE_TAG) $(DOCKER_COMPOSE) build
docker_docs:
docker_docs: docker_image
NB_DIR=notebooks $(DOCKER_COMPOSE) run docs ./.ci/gitlab/test_docs.bash
docker_run: docker_image
......
Markdown is supported
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