File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33
44# Chown only if needed to avoid duplicate files in Docker layers
55
6- # Give user permission on all files in HOME
76find " ${HOME} " -not -user " ${USERNAME} " -execdir chown --no-dereference " ${USERNAME} :${GROUPNAME} " {} \+
8-
7+ find " /opt/ " -not -user " ${USERNAME} " -execdir chown --no-dereference " ${USERNAME} : ${GROUPNAME} " {} \+
98# Give user permissions on all files in /usr/local except cuda folders
109find /usr/local/ \( -path " /usr/local/cuda*" -prune \) -o \
1110\( -not -user " ${USERNAME} " -execdir chown --no-dereference " ${USERNAME} :${GROUPNAME} " {} + \)
Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ fileExistenceTests:
1313 path : " /opt/onyxia-init.sh"
1414 shouldExist : true
1515 permissions : " -rwxr-xr-x"
16- uid : 0
17- gid : 0
16+ uid : 1000
17+ gid : 100
1818commandTests :
1919 - name : " Does the binary exists?"
2020 command : " which"
Original file line number Diff line number Diff line change @@ -14,8 +14,8 @@ fileExistenceTests:
1414 path : " /opt/onyxia-init.sh"
1515 shouldExist : true
1616 permissions : " -rwxr-xr-x"
17- uid : 0
18- gid : 0
17+ uid : 1000
18+ gid : 100
1919commandTests :
2020 - name : " Does the binary exists?"
2121 command : " which"
@@ -29,10 +29,18 @@ commandTests:
2929 command : " which"
3030 args : ["mc"]
3131 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']
3240 - name : " Does the binary exists?"
3341 command : " which"
3442 args : ["jupyter-lab"]
35- expectedOutput : ["/usr/local /bin/jupyter-lab"]
43+ expectedOutput : ["/opt/python /bin/jupyter-lab"]
3644 - name : " Does the binary exists?"
3745 command : " which"
3846 args : ["duckdb"]
Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ fileExistenceTests:
1313 path : " /opt/onyxia-init.sh"
1414 shouldExist : true
1515 permissions : " -rwxr-xr-x"
16- uid : 0
17- gid : 0
16+ uid : 1000
17+ gid : 100
1818commandTests :
1919 - name : " Does the binary exists?"
2020 command : " which"
@@ -31,11 +31,11 @@ commandTests:
3131 - name : " Does the binary exists?"
3232 command : " which"
3333 args : ["python"]
34- expectedOutput : ["/usr/local /bin/python" ]
34+ expectedOutput : ['/opt/python /bin/python' ]
3535 - name : " Does the binary exists?"
3636 command : " which"
3737 args : ["pip"]
38- expectedOutput : ["/usr/local /bin/pip" ]
38+ expectedOutput : ['/opt/python /bin/pip' ]
3939 - name : " Does the binary exists?"
4040 command : " which"
4141 args : ["quarto"]
Original file line number Diff line number Diff line change @@ -6,8 +6,9 @@ LABEL maintainer="InseeFrLab <innovation@insee.fr>"
66ARG PYTHON_VERSION="3.13.5"
77ENV PYTHON_VERSION=${PYTHON_VERSION}
88
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}"
1112
1213USER root
1314
Original file line number Diff line number Diff line change @@ -29,25 +29,19 @@ apt_install \
2929 xz-utils \
3030 zlib1g-dev
3131
32- # Install Python
32+ # Build Python from sources
3333wget -q https://www.python.org/ftp/python/${PYTHON_VERSION} /Python-${PYTHON_VERSION} .tgz
3434tar xzvf Python-${PYTHON_VERSION} .tgz
3535cd Python-${PYTHON_VERSION}
3636./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) "
4244make 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
5145
5246# Clean install files
5347cd ..
@@ -56,6 +50,14 @@ apt-mark auto '.*' > /dev/null
5650apt-mark manual $savedAptMark
5751apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false
5852
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
6062pip install --no-cache-dir --upgrade pip
6163pip install --no-cache-dir uv
Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ fileExistenceTests:
1313 path : " /opt/onyxia-init.sh"
1414 shouldExist : true
1515 permissions : " -rwxr-xr-x"
16- uid : 0
17- gid : 0
16+ uid : 1000
17+ gid : 100
1818commandTests :
1919 - name : " Does the binary exists?"
2020 command : " which"
@@ -31,11 +31,11 @@ commandTests:
3131 - name : " Does the binary exists?"
3232 command : " which"
3333 args : ["python"]
34- expectedOutput : ["/usr/local /bin/python" ]
34+ expectedOutput : ['/opt/python /bin/python' ]
3535 - name : " Does the binary exists?"
3636 command : " which"
3737 args : ["pip"]
38- expectedOutput : ["/usr/local /bin/pip" ]
38+ expectedOutput : ['/opt/python /bin/pip' ]
3939 - name : " Does the binary exists?"
4040 command : " which"
4141 args : ["duckdb"]
Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ fileExistenceTests:
1313 path : " /opt/onyxia-init.sh"
1414 shouldExist : true
1515 permissions : " -rwxr-xr-x"
16- uid : 0
17- gid : 0
16+ uid : 1000
17+ gid : 100
1818commandTests :
1919 - name : " Does the binary exists?"
2020 command : " which"
@@ -31,11 +31,11 @@ commandTests:
3131 - name : " Does the binary exists?"
3232 command : " which"
3333 args : ["python"]
34- expectedOutput : ["/usr/local /bin/python" ]
34+ expectedOutput : ['/opt/python /bin/python' ]
3535 - name : " Does the binary exists?"
3636 command : " which"
3737 args : ["pip"]
38- expectedOutput : ["/usr/local /bin/pip" ]
38+ expectedOutput : ['/opt/python /bin/pip' ]
3939 - name : " Does the binary exists?"
4040 command : " which"
4141 args : ["duckdb"]
Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ fileExistenceTests:
1313 path : " /opt/onyxia-init.sh"
1414 shouldExist : true
1515 permissions : " -rwxr-xr-x"
16- uid : 0
17- gid : 0
16+ uid : 1000
17+ gid : 100
1818commandTests :
1919 - name : " Does the binary exists?"
2020 command : " which"
@@ -31,11 +31,11 @@ commandTests:
3131 - name : " Does the binary exists?"
3232 command : " which"
3333 args : ["python"]
34- expectedOutput : ["/usr/local /bin/python" ]
34+ expectedOutput : ['/opt/python /bin/python' ]
3535 - name : " Does the binary exists?"
3636 command : " which"
3737 args : ["pip"]
38- expectedOutput : ["/usr/local /bin/pip" ]
38+ expectedOutput : ['/opt/python /bin/pip' ]
3939 - name : " Does the binary exists?"
4040 command : " which"
4141 args : ["duckdb"]
Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ fileExistenceTests:
1313 path : " /opt/onyxia-init.sh"
1414 shouldExist : true
1515 permissions : " -rwxr-xr-x"
16- uid : 0
17- gid : 0
16+ uid : 1000
17+ gid : 100
1818commandTests :
1919 - name : " Does the binary exists?"
2020 command : " which"
You can’t perform that action at this time.
0 commit comments