multi-stage build attempts

This commit is contained in:
Michael Pilosov 2021-12-24 14:17:22 -07:00
parent 0d48350473
commit a9ebc2798e
2 changed files with 38 additions and 25 deletions

View File

@ -1,4 +1,5 @@
FROM docker.io/python:3.9.7-bullseye
ARG PYTHON_TAG
FROM docker.io/debian:bullseye-20211220-slim AS fenics
ARG DEBIAN_FRONTEND=noninteractive
# dolfin
@ -18,17 +19,14 @@ RUN apt-get update -yqq && \
apt-get -qq clean && \
rm -rf /var/lib/apt/lists/*
RUN pip install numpy scipy
# fenics
RUN pip install -U fenics-ffc
ENV FENICS_VERSION=2019.1.0.post0
RUN mkdir -p /tmp/src/
RUN git config --global user.email mm@clfx.cc
RUN git config --global user.name mm
ENV FENICS_VERSION=2019.1.0.post0
#RUN apt-get update -yqq && apt-get install libopenmpi-dev
RUN cd /tmp/src/ && \
RUN mkdir -p /tmp/src/ && cd /tmp/src/ && \
git clone --branch=$FENICS_VERSION https://bitbucket.org/fenics-project/dolfin
COPY *.patch /tmp/src/dolfin/
RUN cd /tmp/src/dolfin && \
@ -38,19 +36,6 @@ RUN cd /tmp/src/dolfin && \
mkdir dolfin/build && cd dolfin/build && \
cmake .. && make install
ENV PYBIND11_VERSION=2.2.3
RUN cd /tmp/src/ && \
wget -nc --quiet https://github.com/pybind/pybind11/archive/v${PYBIND11_VERSION}.tar.gz && \
tar -xf v${PYBIND11_VERSION}.tar.gz && \
cd pybind11-${PYBIND11_VERSION} && \
mkdir build && cd build && \
cmake -DPYBIND11_TEST=off .. && make install && \
rm -rf v${PYBIND11_VERSION}.tar.gz
RUN cd /tmp/src/dolfin/python && \
pip3 install .
# mshr
RUN apt-get update -yqq && \
apt-get install -yqq \
@ -61,11 +46,31 @@ RUN apt-get update -yqq && \
apt-get -qq clean && \
rm -rf /var/lib/apt/lists/*
RUN cd /tmp/src/ && \
RUN mkdir -p /tmp/src/ && cd /tmp/src/ && \
git clone --branch=2019.1.0 https://bitbucket.org/fenics-project/mshr && \
mkdir mshr/build && cd mshr/build && \
cmake .. && make install
FROM docker.io/python:${PYTHON_TAG} AS python-bindings
ENV PYBIND11_VERSION=2.2.3
RUN mkdir -p /tmp/src/ && cd /tmp/src/ && \
wget -nc --quiet https://github.com/pybind/pybind11/archive/v${PYBIND11_VERSION}.tar.gz && \
tar -xf v${PYBIND11_VERSION}.tar.gz && \
cd pybind11-${PYBIND11_VERSION} && \
mkdir build && cd build && \
cmake -DPYBIND11_TEST=off .. && make install && \
rm -rf v${PYBIND11_VERSION}.tar.gz
RUN pip install numpy scipy
RUN pip install -U fenics-ffc
COPY --from=fenics /tmp/src/dolfin /tmp/src/
RUN cd /tmp/src/dolfin/python && \
pip3 install .
COPY --from=fenics /tmp/src/mshr /tmp/src/
RUN cd /tmp/src/mshr/python && \
pip3 install .

View File

@ -1,7 +1,15 @@
build: 2019.1.0
latest:
docker build -t fenics -f Dockerfile .
buster:
for TAG in $(shell echo 3.6.{9..13}-buster | sort); do \
VER=2019.1.0; \
echo BUILDING $$VER-$$TAG; \
docker build \
-t mindthemath/fenics-arm64:$$VER-$$TAG \
--build-arg PYTHON_TAG=$$TAG \
-f Dockerfile . && \
docker push mindthemath/fenics-arm64:$$VER-$$TAG || exit ; \
done
2019.1.0:
docker build -t fenics -t fenics-2019.1.0 -f Dockerfile-2019.1.0 .
@ -11,9 +19,9 @@ latest:
SHELL=bash
# docker buildx build --platform linux/amd64,linux/arm64
buster:
# for TAG in $(shell echo 3.6.{9..13}-buster 3.{7..8}.{4..10}-buster {3.6.{14..15},3.{7..8}.{11..12},3.9.{6..9},3.10.{0..1}}-buster | sort); do
for TAG in $(shell echo 3.{7..8}.{4..10}-buster {3.6.{14..15},3.{7..8}.{11..12},3.9.{6..9},3.10.{0..1}}-buster | sort); do \
old_buster:
# for TAG in $(shell echo 3.{7..8}.{4..10}-buster {3.6.{14..15},3.{7..8}.{11..12},3.9.{6..9},3.10.{0..1}}-buster | sort); do
for TAG in $(shell echo 3.6.{9..13}-buster 3.{7..8}.{4..10}-buster {3.6.{14..15},3.{7..8}.{11..12},3.9.{6..9},3.10.{0..1}}-buster | sort); do \
VER=2019.1.0;\
echo BUILDING $$VER-$$TAG; \
docker pull mindthemath/fenics-arm64:$$VER-$$TAG; \