Skip to content

Commit

Permalink
Provide docker containers using released conda packages instead of cu…
Browse files Browse the repository at this point in the history
…stom built. add script for building multi-arch packages
  • Loading branch information
hobu committed Apr 11, 2024
1 parent bed54eb commit 6d81548
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 25 deletions.
26 changes: 1 addition & 25 deletions scripts/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,14 @@ RUN printf "I'm building for TARGETPLATFORM=${TARGETPLATFORM}" \
&& printf "and branch: ${BRANCH}"


#RUN echo Branch: $branch
#ADD https://api.github.com/repos/connormanning/entwine/commits?sha=$branch \
# /tmp/bust-cache

RUN mamba install -c conda-forge conda-pack -y
RUN mamba create -n build -y -c conda-forge ninja cmake compilers
RUN mamba create -n entwine -y

SHELL ["conda", "run", "-n", "build", "/bin/bash", "-c"]

RUN mamba install -y -c conda-forge entwine --only-deps

RUN git clone https://github.com/connormanning/entwine.git /var/entwine && \
cd /var/entwine && \
git checkout $BRANCH && \
mkdir build && \
cd build && \
cmake -G Ninja \
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
-DCMAKE_BUILD_TYPE=Release .. && \
ninja && \
ninja install
RUN mamba create -n entwine entwine -y

SHELL ["conda", "run", "-n", "entwine", "/bin/bash", "-c"]

ENV CONDA_ENV_NAME "entwine"
ENV CONDAENV "/opt/conda/envs/${CONDA_ENV_NAME}"

RUN mamba install -c conda-forge entwine --only-deps
RUN cp /opt/conda/envs/build/bin/entwine $CONDAENV/bin/entwine
RUN cp /opt/conda/envs/build/lib/libentwine.so* $CONDAENV/lib

SHELL ["conda", "run", "-n", "base", "/bin/bash", "-c"]

RUN conda-pack -n ${CONDA_ENV_NAME} --dest-prefix=/var/task -o /tmp/env.tar && \
Expand Down
34 changes: 34 additions & 0 deletions scripts/docker/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

CONTAINER_NAME="connormanning/entwine"
VERSION="3.1.1"

WIPE_CACHE="$1"
if [ -z "$WIPE_CACHE" ]; then
echo "Not wiping cache";
else
WIPE_CACHE="--no-cache"
echo "Wiping cache '$WIPE_CACHE'";

fi

docker buildx build \
-t "$CONTAINER_NAME:$VERSION-amd64" . \
--platform linux/amd64 \
-f Dockerfile --load $WIPE_CACHE

docker buildx build -t "$CONTAINER_NAME:$VERSION-arm64" . \
-f Dockerfile --platform linux/arm64 \
--load $WIPE_CACHE


docker push $CONTAINER_NAME:$VERSION-arm64
docker push $CONTAINER_NAME:$VERSION-amd64

docker manifest create "$CONTAINER_NAME:$VERSION" \
--amend "$CONTAINER_NAME:$VERSION-arm64" \
--amend "$CONTAINER_NAME:$VERSION-amd64"

docker manifest inspect $CONTAINER_NAME:$VERSION

docker manifest push "$CONTAINER_NAME:$VERSION"

0 comments on commit 6d81548

Please sign in to comment.