File tree Expand file tree Collapse file tree 18 files changed +71
-56
lines changed Expand file tree Collapse file tree 18 files changed +71
-56
lines changed Original file line number Diff line number Diff line change 3
3
4
4
# Chown only if needed to avoid duplicate files in Docker layers
5
5
6
- # Give user permission on all files in HOME
7
6
find " ${HOME} " -not -user " ${USERNAME} " -execdir chown --no-dereference " ${USERNAME} :${GROUPNAME} " {} \+
8
-
7
+ find " /opt/ " -not -user " ${USERNAME} " -execdir chown --no-dereference " ${USERNAME} : ${GROUPNAME} " {} \+
9
8
# Give user permissions on all files in /usr/local except cuda folders
10
9
find /usr/local/ \( -path " /usr/local/cuda*" -prune \) -o \
11
10
\( -not -user " ${USERNAME} " -execdir chown --no-dereference " ${USERNAME} :${GROUPNAME} " {} + \)
Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ fileExistenceTests:
13
13
path : " /opt/onyxia-init.sh"
14
14
shouldExist : true
15
15
permissions : " -rwxr-xr-x"
16
- uid : 0
17
- gid : 0
16
+ uid : 1000
17
+ gid : 100
18
18
commandTests :
19
19
- name : " Does the binary exists?"
20
20
command : " which"
Original file line number Diff line number Diff line change @@ -14,8 +14,8 @@ fileExistenceTests:
14
14
path : " /opt/onyxia-init.sh"
15
15
shouldExist : true
16
16
permissions : " -rwxr-xr-x"
17
- uid : 0
18
- gid : 0
17
+ uid : 1000
18
+ gid : 100
19
19
commandTests :
20
20
- name : " Does the binary exists?"
21
21
command : " which"
@@ -29,10 +29,18 @@ commandTests:
29
29
command : " which"
30
30
args : ["mc"]
31
31
expectedOutput : ["/usr/local/bin/mc"]
32
+ - name : " Does the binary exists?"
33
+ command : " which"
34
+ args : ["python"]
35
+ expectedOutput : ['/opt/python/bin/python']
36
+ - name : " Does the binary exists?"
37
+ command : " which"
38
+ args : ["pip"]
39
+ expectedOutput : ['/opt/python/bin/pip']
32
40
- name : " Does the binary exists?"
33
41
command : " which"
34
42
args : ["jupyter-lab"]
35
- expectedOutput : ["/usr/local /bin/jupyter-lab"]
43
+ expectedOutput : ["/opt/python /bin/jupyter-lab"]
36
44
- name : " Does the binary exists?"
37
45
command : " which"
38
46
args : ["duckdb"]
Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ fileExistenceTests:
13
13
path : " /opt/onyxia-init.sh"
14
14
shouldExist : true
15
15
permissions : " -rwxr-xr-x"
16
- uid : 0
17
- gid : 0
16
+ uid : 1000
17
+ gid : 100
18
18
commandTests :
19
19
- name : " Does the binary exists?"
20
20
command : " which"
@@ -31,11 +31,11 @@ commandTests:
31
31
- name : " Does the binary exists?"
32
32
command : " which"
33
33
args : ["python"]
34
- expectedOutput : ["/usr/local /bin/python" ]
34
+ expectedOutput : ['/opt/python /bin/python' ]
35
35
- name : " Does the binary exists?"
36
36
command : " which"
37
37
args : ["pip"]
38
- expectedOutput : ["/usr/local /bin/pip" ]
38
+ expectedOutput : ['/opt/python /bin/pip' ]
39
39
- name : " Does the binary exists?"
40
40
command : " which"
41
41
args : ["quarto"]
Original file line number Diff line number Diff line change 6
6
ARG PYTHON_VERSION="3.13.5"
7
7
ENV PYTHON_VERSION=${PYTHON_VERSION}
8
8
9
- # Ensure local Python is preferred over system version
10
- ENV PATH="/usr/local/bin:${PATH}"
9
+ # Install Python separately from system installation to avoid conflicts
10
+ ARG PYTHON_DIR="/opt/python"
11
+ ENV PATH="${PYTHON_DIR}/bin:${PATH}"
11
12
12
13
USER root
13
14
Original file line number Diff line number Diff line change @@ -29,25 +29,19 @@ apt_install \
29
29
xz-utils \
30
30
zlib1g-dev
31
31
32
- # Install Python
32
+ # Build Python from sources
33
33
wget -q https://www.python.org/ftp/python/${PYTHON_VERSION} /Python-${PYTHON_VERSION} .tgz
34
34
tar xzvf Python-${PYTHON_VERSION} .tgz
35
35
cd Python-${PYTHON_VERSION}
36
36
./configure \
37
- --enable-loadable-sqlite-extensions \
38
- --enable-optimizations \
39
- --enable-shared \
40
- --with-lto
41
- make -j4
37
+ --prefix=" ${PYTHON_DIR} " \
38
+ --enable-loadable-sqlite-extensions \
39
+ --enable-optimizations \
40
+ --enable-shared \
41
+ --with-lto \
42
+ LDFLAGS=" -Wl,-rpath ${PYTHON_DIR} /lib"
43
+ make -j" $( nproc) "
42
44
make install
43
- ldconfig
44
-
45
- # Useful symlinks
46
- ln -s /usr/local/bin/python3 /usr/local/bin/python
47
- ln -s /usr/local/bin/pip3 /usr/local/bin/pip
48
-
49
- # Checks
50
- python --version
51
45
52
46
# Clean install files
53
47
cd ..
@@ -56,6 +50,14 @@ apt-mark auto '.*' > /dev/null
56
50
apt-mark manual $savedAptMark
57
51
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false
58
52
59
- # Upgrade pip & install uv for further Python packages installation
53
+ # Useful symlinks
54
+ ln -sf " ${PYTHON_DIR} /bin/python3" " ${PYTHON_DIR} /bin/python"
55
+ ln -sf " ${PYTHON_DIR} /bin/pip3" " ${PYTHON_DIR} /bin/pip"
56
+
57
+ # Checks
58
+ python --version
59
+ which python
60
+
61
+ # Upgrade pip & install uv
60
62
pip install --no-cache-dir --upgrade pip
61
63
pip install --no-cache-dir uv
Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ fileExistenceTests:
13
13
path : " /opt/onyxia-init.sh"
14
14
shouldExist : true
15
15
permissions : " -rwxr-xr-x"
16
- uid : 0
17
- gid : 0
16
+ uid : 1000
17
+ gid : 100
18
18
commandTests :
19
19
- name : " Does the binary exists?"
20
20
command : " which"
@@ -31,11 +31,11 @@ commandTests:
31
31
- name : " Does the binary exists?"
32
32
command : " which"
33
33
args : ["python"]
34
- expectedOutput : ["/usr/local /bin/python" ]
34
+ expectedOutput : ['/opt/python /bin/python' ]
35
35
- name : " Does the binary exists?"
36
36
command : " which"
37
37
args : ["pip"]
38
- expectedOutput : ["/usr/local /bin/pip" ]
38
+ expectedOutput : ['/opt/python /bin/pip' ]
39
39
- name : " Does the binary exists?"
40
40
command : " which"
41
41
args : ["duckdb"]
Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ fileExistenceTests:
13
13
path : " /opt/onyxia-init.sh"
14
14
shouldExist : true
15
15
permissions : " -rwxr-xr-x"
16
- uid : 0
17
- gid : 0
16
+ uid : 1000
17
+ gid : 100
18
18
commandTests :
19
19
- name : " Does the binary exists?"
20
20
command : " which"
@@ -31,11 +31,11 @@ commandTests:
31
31
- name : " Does the binary exists?"
32
32
command : " which"
33
33
args : ["python"]
34
- expectedOutput : ["/usr/local /bin/python" ]
34
+ expectedOutput : ['/opt/python /bin/python' ]
35
35
- name : " Does the binary exists?"
36
36
command : " which"
37
37
args : ["pip"]
38
- expectedOutput : ["/usr/local /bin/pip" ]
38
+ expectedOutput : ['/opt/python /bin/pip' ]
39
39
- name : " Does the binary exists?"
40
40
command : " which"
41
41
args : ["duckdb"]
Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ fileExistenceTests:
13
13
path : " /opt/onyxia-init.sh"
14
14
shouldExist : true
15
15
permissions : " -rwxr-xr-x"
16
- uid : 0
17
- gid : 0
16
+ uid : 1000
17
+ gid : 100
18
18
commandTests :
19
19
- name : " Does the binary exists?"
20
20
command : " which"
@@ -31,11 +31,11 @@ commandTests:
31
31
- name : " Does the binary exists?"
32
32
command : " which"
33
33
args : ["python"]
34
- expectedOutput : ["/usr/local /bin/python" ]
34
+ expectedOutput : ['/opt/python /bin/python' ]
35
35
- name : " Does the binary exists?"
36
36
command : " which"
37
37
args : ["pip"]
38
- expectedOutput : ["/usr/local /bin/pip" ]
38
+ expectedOutput : ['/opt/python /bin/pip' ]
39
39
- name : " Does the binary exists?"
40
40
command : " which"
41
41
args : ["duckdb"]
Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ fileExistenceTests:
13
13
path : " /opt/onyxia-init.sh"
14
14
shouldExist : true
15
15
permissions : " -rwxr-xr-x"
16
- uid : 0
17
- gid : 0
16
+ uid : 1000
17
+ gid : 100
18
18
commandTests :
19
19
- name : " Does the binary exists?"
20
20
command : " which"
You can’t perform that action at this time.
0 commit comments