Skip to content

Commit 17949b2

Browse files
authored
Add files for creating container. (#314)
1 parent 0d13d5a commit 17949b2

File tree

3 files changed

+65
-0
lines changed

3 files changed

+65
-0
lines changed

scripts/Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM ecpe4s/ubuntu20.04-runner-x86_64:2022-05-01
2+
3+
ARG BUILD_DATE
4+
ARG COMMIT
5+
6+
RUN git clone --recursive https://github.com/exawind/exawind-manager \
7+
&& git -C exawind-manager checkout $COMMIT
8+
9+
ENV E4S_MACHINE=1
10+
ENV EXAWIND_MANAGER=/exawind-manager
11+
12+
WORKDIR /exawind-manager/scripts
13+
RUN ["/bin/bash", "./ci-creator.sh"]
14+
15+
WORKDIR /
16+
RUN apt update -y \
17+
&& apt install -y clangd \
18+
&& apt clean -y
19+
20+
RUN echo export EXAWIND_MANAGER=$EXAWIND_MANAGER >> /etc/bash.bashrc \
21+
&& echo export E4S_MACHINE=1 >> /etc/bash.bashrc \
22+
&& echo ". \$EXAWIND_MANAGER/start.sh" >> /etc/bash.bashrc \
23+
&& echo spack-start >> /etc/bash.bashrc
24+
25+
LABEL io.e4s.build-date=${BUILD_DATE}
26+

scripts/generate-snapshot-image.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash -e
2+
3+
if [[ $# -ne 1 ]] ; then
4+
echo error: please specify the commit to use
5+
echo "usage: $0 <commit>"
6+
exit 1
7+
fi
8+
9+
COMMIT=$1
10+
11+
cmd() {
12+
echo "+ $@"
13+
eval "$@"
14+
}
15+
16+
BUILD_DATE=$(printf '%(%Y-%m-%d)T' -1)
17+
REGISTRY=${REGISTRY:-ecpe4s}
18+
OUTPUT_IMAGE_REPO="${REGISTRY}/exawind-snapshot"
19+
DATED_IMAGE="${OUTPUT_IMAGE_REPO}:${BUILD_DATE}"
20+
LATEST_IMAGE="${OUTPUT_IMAGE_REPO}:latest"
21+
22+
cmd time docker build --no-cache --build-arg COMMIT=$COMMIT --build-arg BUILD_DATE="${BUILD_DATE}" -t ${DATED_IMAGE} .
23+
cmd docker tag ${DATED_IMAGE} ${LATEST_IMAGE}
24+
25+
echo $DOCKER_PASSWORD | docker login --username esw123 --password-stdin
26+
cmd docker push ${DATED_IMAGE}
27+
cmd docker push ${LATEST_IMAGE}
28+
cmd docker logout
29+

scripts/gitlab-ci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
stages:
2+
- "0"
3+
4+
create-snapshot-image:
5+
stage: "0"
6+
tags: [exawind-ci]
7+
script:
8+
- export EXAWIND_COMMIT=$(curl --request GET --url "https://api.github.com/repos/exawind/exawind-manager/commits/main" | jq -r '.sha')
9+
- ./generate-snapshot-image.sh $EXAWIND_COMMIT
10+

0 commit comments

Comments
 (0)