@@ -7,7 +7,11 @@ RUN useradd -m -s /bin/bash vscode
77
88WORKDIR /workspace
99
10- RUN export DEBIAN_FRONTEND=noninteractive
10+ # Configure apt proxy settings if proxy environment variables are set
11+ RUN if [ -n "$http_proxy" ] || [ -n "$https_proxy" ]; then \
12+ echo "Acquire::http::Proxy \" $http_proxy\" ;" > /etc/apt/apt.conf.d/01proxy; \
13+ echo "Acquire::https::Proxy \" $https_proxy\" ;" >> /etc/apt/apt.conf.d/01proxy; \
14+ fi
1115
1216# please keep pkgs sorted
1317RUN \
@@ -42,15 +46,34 @@ RUN \
4246 ruby-dev \
4347 shellcheck
4448
45- # Create a virtual environment and install Python requirements
49+ # Configure pip proxy settings
50+ RUN if [ -n "$http_proxy" ] || [ -n "$https_proxy" ]; then \
51+ echo "[global]" > /etc/pip.conf; \
52+ if [ -n "$http_proxy" ]; then echo "proxy = $http_proxy" >> /etc/pip.conf; fi; \
53+ if [ -n "$https_proxy" ]; then echo "trusted-host = pypi.org" >> /etc/pip.conf; \
54+ echo "trusted-host = pypi.python.org" >> /etc/pip.conf; \
55+ echo "trusted-host = files.pythonhosted.org" >> /etc/pip.conf; fi; \
56+ fi
57+
58+ # Configure npm proxy settings
59+ RUN if [ -n "$http_proxy" ]; then npm config set proxy $http_proxy; fi
60+ RUN if [ -n "$https_proxy" ]; then npm config set https-proxy $https_proxy; fi
61+
62+ # Configure bundler proxy settings
63+ RUN if [ -n "$http_proxy" ]; then bundle config http_proxy $http_proxy; fi
64+ RUN if [ -n "$https_proxy" ]; then bundle config https_proxy $https_proxy; fi
65+
66+ # Create a virtual environment for Python packages
4667RUN python3 -m venv /opt/venv
4768ENV PATH="/opt/venv/bin:$PATH"
48- RUN pip install -r /workspace/requirements.txt
69+
70+ # Note: requirements.txt will be installed in the updateContentCommand.sh or onCreateCommand.sh scripts
71+ # This avoids issues with trying to install requirements before the workspace is mounted
4972
5073RUN apt-get clean autoclean
5174RUN apt-get autoremove -y
5275RUN rm -rf /var/lib/{apt,dpkg,cache,log}/*
5376
5477# Switch to non-root user
5578USER vscode
56- WORKDIR /home/vscode
79+ WORKDIR /home/vscode
0 commit comments