Commit 58619879 authored by Patrick Godwin's avatar Patrick Godwin
Browse files

move conda Dockerfile from gitlab-ci.yml to own file, switch to multi-stage...

move conda Dockerfile from gitlab-ci.yml to own file, switch to multi-stage build to slim container size
parent d2373104
Pipeline #204345 failed with stages
in 5 minutes and 11 seconds
# This is a Dockerfile to build a conda GstLAL
# runtime container.
ARG CI_REGISTRY_IMAGE
ARG CI_COMMIT_REF_NAME
# Build stage
FROM $CI_REGISTRY_IMAGE/dependencies/conda:$CI_COMMIT_REF_NAME AS build
# Labeling/packaging stuff:
LABEL name="GstLAL Runtime Package, conda" \
maintainer="Patrick Godwin <patrick.godwin@ligo.org>" \
date="2021-03-18"
# Copy source to container
COPY gstlal /gstlal
COPY gstlal-ugly /gstlal-ugly
COPY gstlal-inspiral /gstlal-inspiral
COPY gstlal-burst /gstlal-burst
# Switch to bash shell
SHELL ["/bin/bash", "-c"]
# Install gstlal
RUN . /opt/conda/etc/profile.d/conda.sh && \
conda activate base && \
export PREFIX="/opt/conda" && \
export CONDA_BUILD="1" && \
conda activate base && \
cd /gstlal && \
./00init.sh && \
./configure --prefix=/opt/conda --without-doxygen && \
make -j$NUM_CORES && \
make install -j$NUM_CORES
RUN rm -rf gstlal
# Install gstlal-ugly
RUN . /opt/conda/etc/profile.d/conda.sh && \
conda activate base && \
export PREFIX="/opt/conda" && \
export CONDA_BUILD="1" && \
conda activate base && \
cd /gstlal-ugly && \
./00init.sh && \
./configure --prefix=/opt/conda --without-doxygen --without-gds && \
make -j$NUM_CORES && \
make install -j$NUM_CORES
RUN rm -rf gstlal-ugly
# Install gstlal-burst
RUN . /opt/conda/etc/profile.d/conda.sh && \
conda activate base && \
export PREFIX="/opt/conda" && \
export CONDA_BUILD="1" && \
conda activate base && \
cd /gstlal-burst && \
./00init.sh && \
./configure --prefix=/opt/conda --without-doxygen && \
make -j$NUM_CORES && \
make install -j$NUM_CORES
RUN rm -rf gstlal-burst
# Install gstlal-inspiral
RUN . /opt/conda/etc/profile.d/conda.sh && \
conda activate base && \
export PREFIX="/opt/conda" && \
export CONDA_BUILD="1" && \
conda activate base && \
cd /gstlal-inspiral && \
./00init.sh && \
./configure --prefix=/opt/conda --without-doxygen --disable-massmodel && \
make -j$NUM_CORES && \
make install -j$NUM_CORES
RUN rm -rf gstlal-inspiral
# Run stage
ARG CI_REGISTRY_IMAGE
ARG CI_COMMIT_REF_NAME
FROM $CI_REGISTRY_IMAGE/dependencies/conda:$CI_COMMIT_REF_NAME AS run
# Copy build artifacts
COPY --from=build /opt/conda /opt/conda
# Export environment variables:
ENV PKG_CONFIG_PATH /opt/conda/lib/pkgconfig
ENV GST_PLUGIN_PATH /opt/conda/lib/gstreamer-1.0
ENV GSTLAL_FIR_WHITEN 0
ENV TMPDIR /tmp
ENTRYPOINT bash
......@@ -63,10 +63,15 @@ stages:
COPY gstlal-inspiral/share/conda/dev-environment.yml .
RUN conda config --set always_yes yes
RUN conda config --add channels conda-forge
RUN conda update -n base conda
RUN conda env update -n base -f dev-environment.yml
RUN conda install vim wget curl
RUN conda update -n base conda && \
conda clean -af
RUN conda env update -n base -f dev-environment.yml && \
conda clean -af
RUN conda install vim wget curl && \
conda clean -af
RUN rm -f dev-environment.yml
ENV PKG_CONFIG_PATH /opt/conda/lib/pkgconfig
ENV GST_PLUGIN_PATH /opt/conda/lib/gstreamer-1.0
ENTRYPOINT bash
EOF
- docker build -t $IMAGE_TAG .
......@@ -335,46 +340,13 @@ docker:conda:
script:
- IMAGE_TAG=$CI_REGISTRY_IMAGE/conda:$CI_COMMIT_REF_NAME
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- |
cat <<EOF > Dockerfile
FROM $CI_REGISTRY_IMAGE/dependencies/conda:$CI_COMMIT_REF_NAME
COPY gstlal /gstlal
COPY gstlal-ugly /gstlal-ugly
COPY gstlal-inspiral /gstlal-inspiral
COPY gstlal-burst /gstlal-burst
RUN cd /gstlal && \
./00init.sh && \
PREFIX=/opt/conda CONDA_BUILD="1" ./configure --prefix=/opt/conda --without-doxygen && \
make -j$NUM_CORES && \
make install -j$NUM_CORES && \
cd .. && \
rm -rf gstlal && \
RUN cd /gstlal-ugly && \
./00init.sh && \
PREFIX=/opt/conda CONDA_BUILD="1" ./configure --prefix=/opt/conda --without-doxygen --without-gds && \
make -j$NUM_CORES && \
make install -j$NUM_CORES && \
cd .. && \
rm -rf gstlal-ugly && \
RUN cd /gstlal-inspiral && \
./00init.sh && \
PREFIX=/opt/conda CONDA_BUILD="1" ./configure --prefix=/opt/conda --without-doxygen && \
make -j$NUM_CORES && \
make install -j$NUM_CORES && \
cd .. && \
rm -rf gstlal-inspiral && \
RUN cd /gstlal-burst && \
./00init.sh && \
PREFIX=/opt/conda CONDA_BUILD="1" ./configure --prefix=/opt/conda && \
make -j$NUM_CORES && \
make install -j$NUM_CORES && \
cd .. && \
rm -rf gstlal-burst && \
ENV PKG_CONFIG_PATH /opt/conda/lib/pkgconfig
ENV GST_PLUGIN_PATH /opt/conda/lib/gstreamer-1.0
ENTRYPOINT bash
EOF
- docker build -t $IMAGE_TAG .
- >
docker build --pull
--build-arg CI_REGISTRY_IMAGE=$CI_REGISTRY_IMAGE
--build-arg CI_COMMIT_REF_NAME=$CI_COMMIT_REF_NAME
-t $IMAGE_TAG
--file .gitlab-ci.Dockerfile.conda
.
- docker push $IMAGE_TAG
needs:
- dependencies/conda
......
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