Skip to content

Instantly share code, notes, and snippets.

@tueda
Last active October 12, 2024 06:29
Show Gist options
  • Save tueda/aa0f10331289e4a294eb6fa242f1a5ee to your computer and use it in GitHub Desktop.
Save tueda/aa0f10331289e4a294eb6fa242f1a5ee to your computer and use it in GitHub Desktop.

FORM.devcontainer

curl -s https://gist.githubusercontent.com/tueda/aa0f10331289e4a294eb6fa242f1a5ee/raw/setup.sh | bash -s -- 20.04 mpich
{
"name": "FORM",
"build": {
"dockerfile": "Dockerfile"
}
}
FROM mcr.microsoft.com/devcontainers/base:ubuntu-20.04
RUN apt-get update && apt-get install -y automake build-essential git libgmp-dev libmpfr-dev libmpich-dev ruby zlib1g-dev
RUN apt-get install -y file valgrind
RUN git -C /tmp clone --depth 1 -b v2.47.0 https://github.com/git/git.git \
&& make -C /tmp/git/contrib/diff-highlight/ \
&& cp /tmp/git/contrib/diff-highlight/diff-highlight /usr/local/bin \
&& rm -rf /tmp/git
#!/bin/bash
set -eu
if [ ! -d form ]; then
git clone https://github.com/vermaseren/form.git
git -C form remote add tueda https://github.com/tueda/form.git
git -C form remote add jodavies https://github.com/jodavies/form.git
git -C form fetch --all
fi
mkdir -p .devcontainer
curl -o .devcontainer/devcontainer.json https://gist.githubusercontent.com/tueda/aa0f10331289e4a294eb6fa242f1a5ee/raw/devcontainer.json
curl -o .devcontainer/Dockerfile https://gist.githubusercontent.com/tueda/aa0f10331289e4a294eb6fa242f1a5ee/raw/Dockerfile
for arg in "$@"; do
case $arg in
20.04|22.04|24.04)
sed -i "s|^FROM mcr.microsoft.com/devcontainers/base:ubuntu-.*|FROM mcr.microsoft.com/devcontainers/base:ubuntu-$arg|" .devcontainer/Dockerfile
;;
openmpi|mpich)
sed -i \
-e '/^RUN apt-get update && apt-get install -y/ s/libopenmpi-dev\|libmpich-dev/ /g' \
-e "/^RUN apt-get update && apt-get install -y/ s/$/ lib$arg-dev/" \
-e '/^RUN apt-get update && apt-get install -y/ s/ */ /g' \
.devcontainer/Dockerfile
;;
*)
echo "unknown option: $arg">&1
;;
esac
shift
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment