Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
eic_container
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
containers
eic_container
Commits
846693d7
Commit
846693d7
authored
1 year ago
by
Wouter Deconinck
Browse files
Options
Downloads
Patches
Plain Diff
feat: split spack into separate image
parent
f940abce
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!659
feat: split spack into separate image
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
containers/jug/dev.Dockerfile
+20
-18
20 additions, 18 deletions
containers/jug/dev.Dockerfile
with
20 additions
and
18 deletions
containers/jug/dev.Dockerfile
+
20
−
18
View file @
846693d7
...
...
@@ -4,10 +4,10 @@ ARG BASE_IMAGE="debian_stable_base"
ARG
INTERNAL_TAG="testing"
## ========================================================================================
## STAGE
1
: spack
builder
image
## EIC
builder
image with spack
## STAGE
0
: spack image
## EIC
spack
image with spack
and eic-spack repositories
## ========================================================================================
FROM
${DOCKER_REGISTRY}${BASE_IMAGE}:${INTERNAL_TAG}
as
builder
FROM
${DOCKER_REGISTRY}${BASE_IMAGE}:${INTERNAL_TAG}
as
spack
ARG
TARGETPLATFORM
## install some extra spack dependencies
...
...
@@ -20,8 +20,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=${TARGETPLATFORM}
python3-dev
\
python3-distutils
\
python3-boto3
\
python-is-python3
\
&&
rm
-rf
/var/lib/apt/lists/
*
python-is-python3
## Setup spack
ENV
SPACK_ROOT=/opt/spack
...
...
@@ -43,6 +42,7 @@ RUN git clone https://github.com/${SPACK_ORGREPO}.git ${SPACK_ROOT} \
SHELL
["docker-shell"]
## Setup build configuration
ARG
jobs=64
RUN
declare
-A
target
=(
\
[
"linux/amd64"
]=
"x86_64_v2"
\
...
...
@@ -62,8 +62,8 @@ RUN declare -A target=( \
&&
spack config blame compilers
## Setup local buildcache mirrors
RUN
--mount
=
type
=
cache,target
=
/var/cache/spack
-mirror
\
spack mirror add
local
/var/cache/spack
-
mirror/
${
SPACK_VERSION
}
\
RUN
--mount
=
type
=
cache,target
=
/var/cache/spack
\
spack mirror add
local
/var/cache/spack
/
mirror/
${
SPACK_VERSION
}
\
&&
spack buildcache update-index
local
\
&&
spack mirror list
...
...
@@ -72,7 +72,7 @@ RUN --mount=type=cache,target=/var/cache/spack-mirror \
## - the write-enabled mirror is provided later as a secret mount
ARG
S3_ACCESS_KEY=""
ARG
S3_SECRET_KEY=""
RUN
--mount
=
type
=
cache,target
=
/var/cache/spack
-mirror
\
RUN
--mount
=
type
=
cache,target
=
/var/cache/spack
\
if
[
-n
"
${
S3_ACCESS_KEY
}
"
]
;
then
\
spack mirror add
--scope
site
\
--s3-endpoint-url
https://eics3.sdcc.bnl.gov:9000
\
...
...
@@ -82,12 +82,7 @@ RUN --mount=type=cache,target=/var/cache/spack-mirror \
;
fi
\
&&
spack mirror list
## This variable will change whenever either spack.yaml or our spack package
## overrides change, triggering a rebuild
ARG
CACHE_BUST="hash"
ARG
CACHE_NUKE=""
## Setup our custom package overrides
## Setup eic-spack
ENV
EICSPACK_ROOT=${SPACK_ROOT}/var/spack/repos/eic-spack
ARG
EICSPACK_ORGREPO="eic/eic-spack"
ARG
EICSPACK_VERSION="$SPACK_VERSION"
...
...
@@ -100,12 +95,18 @@ RUN git clone https://github.com/${EICSPACK_ORGREPO}.git ${EICSPACK_ROOT} \
fi
\
&&
spack repo add
--scope
site
"
${
EICSPACK_ROOT
}
"
## ========================================================================================
## STAGE1: builder
## EIC builder image with spack environment
## ========================================================================================
FROM
spack
as
builder
## Setup our custom environment (secret mount for write-enabled mirror)
COPY
--from=spack-environment . /opt/spack-environment/
ARG
ENV=dev
ENV
SPACK_ENV=/opt/spack-environment/${ENV}
RUN
--mount
=
type
=
cache,target
=
/ccache,id
=
${
TARGETPLATFORM
}
\
--mount
=
type
=
cache,target
=
/var/cache/spack
-mirror
\
--mount
=
type
=
cache,target
=
/var/cache/spack
\
--mount
=
type
=
secret,id
=
mirrors,target
=
/opt/spack/etc/spack/mirrors.yaml
\
source
$SPACK_ROOT
/share/spack/setup-env.sh
\
&&
export
CCACHE_DIR
=
/ccache
\
...
...
@@ -116,7 +117,7 @@ RUN --mount=type=cache,target=/ccache,id=${TARGETPLATFORM} \
&&
ccache
--show-stats
## Create view at /usr/local
RUN
--mount
=
type
=
cache,target
=
/var/cache/spack
-mirror
\
RUN
--mount
=
type
=
cache,target
=
/var/cache/spack
\
source
$SPACK_ROOT
/share/spack/setup-env.sh
\
&&
spack
env
activate
--dir
${
SPACK_ENV
}
\
&&
rm
-r
/usr/local
\
...
...
@@ -125,9 +126,10 @@ RUN --mount=type=cache,target=/var/cache/spack-mirror \
## Optional, nuke the buildcache after install, before (re)caching
## This is useful when going to completely different containers,
## or intermittently to keep the buildcache step from taking too much time
RUN
--mount
=
type
=
cache,target
=
/var/cache/spack-mirror,sharing
=
locked
\
ARG
CACHE_NUKE=""
RUN
--mount
=
type
=
cache,target
=
/var/cache/spack,sharing
=
locked
\
[
-z
"
${
CACHE_NUKE
}
"
]
\
||
rm
-rf
/var/cache/spack
-
mirror/
${
SPACK_VERSION
}
/build_cache/
*
||
rm
-rf
/var/cache/spack
/
mirror/
${
SPACK_VERSION
}
/build_cache/
*
## Extra post-spack steps:
## - Python packages
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment