Skip to content

Commit 4ee398f

Browse files
authored
♻️ Add conda initialization and optimize image building network connection #1021
2 parents 595e39e + e32b3ab commit 4ee398f

File tree

2 files changed

+26
-12
lines changed

2 files changed

+26
-12
lines changed

make/terminal/Dockerfile

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,21 @@ FROM ubuntu:24.04
33
# Set environment variables
44
ENV CONDA_DIR=/opt/conda
55

6-
# Install base tools and dependencies
7-
RUN apt-get update && apt-get install -y \
8-
openssh-server \
9-
curl \
10-
wget \
11-
git \
12-
vim \
13-
build-essential \
14-
python3 \
15-
python3-pip \
16-
python3-venv \
17-
&& rm -rf /var/lib/apt/lists/*
6+
# Install base tools and dependencies with retry mechanism and network optimization
7+
RUN apt-get clean && \
8+
apt-get update --fix-missing && \
9+
apt-get install -y --no-install-recommends \
10+
openssh-server \
11+
curl \
12+
wget \
13+
git \
14+
vim \
15+
build-essential \
16+
python3 \
17+
python3-pip \
18+
python3-venv \
19+
&& rm -rf /var/lib/apt/lists/* \
20+
&& apt-get clean
1821

1922
# Create development user
2023
ARG DEV_USER=linuxserver.io
@@ -36,6 +39,10 @@ RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-$(if [ "$TA
3639
# Set conda permissions
3740
RUN chown -R $DEV_USER:$DEV_USER $CONDA_DIR
3841

42+
# Add conda to PATH and initialize
43+
ENV PATH="$CONDA_DIR/bin:$PATH"
44+
RUN conda init
45+
3946
# Create .ssh directory
4047
RUN mkdir -p /home/$DEV_USER/.ssh && \
4148
chown $DEV_USER:$DEV_USER /home/$DEV_USER/.ssh && \

make/terminal/entrypoint.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ else
2727
echo "⚠️ Unable to connect to container via SSH"
2828
fi
2929

30+
# Configure conda auto-activation for development user
31+
echo "Configuring conda auto-activation for user $DEV_USER..."
32+
echo 'export PATH="/opt/conda/bin:$PATH"' >> "$USER_HOME/.bashrc"
33+
echo 'source /opt/conda/etc/profile.d/conda.sh' >> "$USER_HOME/.bashrc"
34+
echo 'conda activate base' >> "$USER_HOME/.bashrc"
35+
chown $DEV_USER:$DEV_USER "$USER_HOME/.bashrc"
36+
3037
# Configure SSH timeout settings
3138
echo "Configuring SSH timeout settings (60 minutes)..."
3239
cat >> /etc/ssh/sshd_config << 'SSHD_EOF'

0 commit comments

Comments
 (0)