-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.dockerfile
57 lines (45 loc) · 1.56 KB
/
test.dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# syntax=docker/dockerfile:1
# Basic build:
# $ docker buildx build --tag maud-test --file test.dockerfile .
#
# To override the docker image:
# $ !! --build-context ubuntu=docker-image://amd64/ubuntu:24.04
#
# Basic run:
# $ docker run --rm --interactive --tty --volume .:/maud maud-test bash
FROM ubuntu
ARG CONDA_ENV
ARG CONDA_VERSION
ENV CONDA_ENV=${CONDA_ENV:-conda_env}
ENV CONDA_VERSION=${CONDA_VERSION:-latest}
RUN <<ENDRUN bash -s # Update apt
export DEBIAN_FRONTEND=noninteractive
apt-get update -y -q
apt-get install -y -q curl wget tzdata libc6-dbg gdb
#apt-get clean
#rm -rf /var/lib/apt/lists/*
ENDRUN
# Mamba has more up-to-date versions of most packages but only gcc-13
RUN apt-get install -y g++-14
RUN <<ENDRUN bash -s # Install conda/mamba via Mambaforge
URL="https://github.com/conda-forge/miniforge/releases"
URL="\$URL/\$CONDA_VERSION"
URL="\$URL/download/Mambaforge-$(uname)-$(uname -m).sh"
wget \$URL -nv -O /tmp/installer.sh
bash /tmp/installer.sh -b -p /opt/conda
rm /tmp/installer.sh
ENDRUN
RUN /opt/conda/bin/mamba init
ADD $CONDA_ENV.txt /
RUN <<ENDRUN bash -s # Initialize and configure conda/mamba
. /opt/conda/etc/profile.d/conda.sh
. /opt/conda/etc/profile.d/mamba.sh
conda config --set show_channel_urls True
conda config --set remote_connect_timeout_secs 12
#mamba clean --all --yes
mamba create --name maud --file /\$CONDA_ENV.txt --yes
# Activate the created environment by default
echo "mamba activate maud" >> ~/.bashrc
ENDRUN
# use login shell when running the container
ENTRYPOINT ["/bin/bash", "-l", "-c"]