-
Notifications
You must be signed in to change notification settings - Fork 0
#16: Make docker build python setup script #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
84dc489
3fcaa82
275a9f5
8cfd3e3
f0544f3
1321d48
e57bac0
d861a96
18680e0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| # Base dockerfile to build images used in Darma testing. | ||
|
|
||
| ARG REPO=lifflander1/vt | ||
| ARG ARCH=amd64 | ||
| ARG BASE=ubuntu:22.04 | ||
|
|
||
|
|
@@ -30,17 +31,10 @@ ARG CMPLR_ROOT \ | |
| LD_LIBRARY_PATH=${LD_LIBRARY_PATH:-""} \ | ||
| LIBRARY_PATH=${LIBRARY_PATH:-""} | ||
|
|
||
| # Copy dependency scripts | ||
| ENV WF_TMP_DIR=/opt/workflows | ||
| ADD ci/shared/scripts/deps ${WF_TMP_DIR}/deps | ||
|
|
||
| # Setup environment variables | ||
| ENV DEBIAN_FRONTEND=noninteractive | ||
|
|
||
| ENV SCRIPTS_INSTALL_DIR=${SCRIPTS_INSTALL_DIR} | ||
|
|
||
| ENV WF_DOCKER=1 \ | ||
| WF_SETUP_ID=${SETUP_ID} | ||
| ENV WF_SETUP_ID=${SETUP_ID} | ||
|
|
||
| ENV CC=$CC \ | ||
| CXX=$CXX \ | ||
|
|
@@ -73,8 +67,11 @@ ENV CMPLR_ROOT=$CMPLR_ROOT \ | |
| LIBRARY_PATH=$LIBRARY_PATH \ | ||
| LD_LIBRARY_PATH=$LD_LIBRARY_PATH | ||
|
|
||
| COPY ci/shared/scripts/setup-${SETUP_ID}.sh ${WF_TMP_DIR}/setup.sh | ||
| RUN chmod +x ${WF_TMP_DIR}/setup.sh && . ${WF_TMP_DIR}/setup.sh | ||
| # Prepare working directory | ||
| ENV WF_TMP_DIR=/opt/workflows | ||
|
|
||
| # Clean | ||
| RUN rm -rf $WF_TMP_DIR | ||
| # Run the setup scripts | ||
| RUN --mount=type=bind,rw,source=ci,target=${WF_TMP_DIR} \ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mounting as https://docs.docker.com/reference/dockerfile/#run---mounttypebind
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TODO: check if https://docs.docker.com/reference/dockerfile/#run---mounttypecache |
||
| sh ${WF_TMP_DIR}/setup-basic.sh && \ | ||
| python3 ${WF_TMP_DIR}/build-setup.py ${REPO}:wf-${SETUP_ID} && \ | ||
| sh ${WF_TMP_DIR}/setup-${SETUP_ID}.sh | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| #!/usr/bin/env sh | ||
|
|
||
| # Basic universal setup script | ||
|
|
||
| echo "------------- Setup --------------" | ||
|
|
||
| OS_VERSION= | ||
| UNAME=$(uname) | ||
| if [ "$UNAME" = "Darwin" ] | ||
| then | ||
| OS_NAME=$(sw_vers -productName) | ||
| OS_VERSION=$(sw_vers -productVersion) | ||
| elif [ "$UNAME" = "Linux" ] | ||
| then | ||
| OS_NAME=$(cat /etc/os-release | grep -E "^NAME=*" | cut -d = -f 2 | tr -d '"') | ||
| OS_VERSION=$(cat /etc/os-release | grep -E "^VERSION_ID=*" | cut -d = -f 2 | tr -d '"') | ||
| fi | ||
|
|
||
| echo "Operating system: $OS_NAME / Version: $OS_VERSION" | ||
| echo "PATH=$PATH" | ||
| echo "CPATH=$CPATH" | ||
| echo "LIBRARY_PATH=$LIBRARY_PATH" | ||
| echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" | ||
| echo "----------------------------------" | ||
|
|
||
| # Save setup environment to ~/.setuprc (used by packages.sh dep for example) | ||
| echo "-- Set up variables (WF_SETUP_ID, OS_NAME, OS_VERSION) > ~/.setuprc" | ||
| { | ||
| echo "export WF_SETUP_ID=\"$WF_SETUP_ID\"" | ||
| echo "export OS_NAME=\"$OS_NAME\"" | ||
| echo "export OS_VERSION=\"$OS_VERSION\"" | ||
| } >> ~/.setuprc | ||
|
|
||
| ### UPDATE PACKAGE LIST AND INSTALL CORE DEPENDENCIES | ||
| echo "-- Installing Core packages ($OS_NAME)..." | ||
| if [ "$OS_NAME" = "Ubuntu" ] | ||
| then | ||
| apt-get update -y -q | ||
| apt-get install -y -q --no-install-recommends ca-certificates wget git python3 python3-yaml | ||
| elif [ "$OS_NAME" = "Alpine Linux" ] | ||
| then | ||
| apk update | ||
| apk add --no-cache wget git bash python3 py3-yaml | ||
| elif [ "$OS_NAME" = "macOS" ] | ||
| then | ||
| brew update | ||
| else | ||
| echo "Error. Please implement the pre-setup instructions for OS=$OS_NAME" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "--" | ||
| echo "-- Core packages installed!" | ||
| echo "--" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cancel in-progress builds when a new push occurs in a PR or on a branch. We should actually use that in other repos (magistrate?) too.
Azure builds in
vthaveautoCancelso that's fine: