Skip to content

Commit ce16a40

Browse files
Fixes for sleep
1 parent 45d3280 commit ce16a40

File tree

3 files changed

+99
-8
lines changed

3 files changed

+99
-8
lines changed

.devcontainer/Dockerfile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,24 @@ ENV PYTHONUNBUFFERED=1 \
1616
PYTHONPATH=/workspaces/Apim-Samples/shared/python:/workspaces/Apim-Samples \
1717
DEBIAN_FRONTEND=noninteractive
1818

19-
# Install system dependencies as root with optimized caching
19+
# Install system dependencies as root with explicit core utilities
2020
USER root
21-
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
22-
--mount=type=cache,target=/var/lib/apt/lists,sharing=locked \
23-
# Remove Python 3.11 and other versions if they exist
24-
apt-get update && \
25-
apt-get remove -y python3.11* python3-minimal python3.11-minimal || true && \
26-
apt-get autoremove -y && \
27-
# Install essential packages including core utilities
21+
RUN apt-get update && \
2822
apt-get install -y --no-install-recommends \
2923
coreutils \
3024
util-linux \
25+
findutils \
26+
grep \
27+
sed \
3128
curl \
3229
wget \
3330
jq \
3431
tree \
3532
git-lfs && \
3633
apt-get clean && \
34+
rm -rf /var/lib/apt/lists/* && \
35+
# Verify core utilities are installed
36+
which sleep && which cat && which grep && \
3737
# Create symbolic links to ensure python3 points to Python 3.12
3838
ln -sf /usr/local/bin/python3.12 /usr/bin/python3 && \
3939
ln -sf /usr/local/bin/python3.12 /usr/bin/python && \

.devcontainer/Dockerfile.minimal

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Minimal bulletproof Dockerfile for troubleshooting
2+
FROM ubuntu:22.04
3+
4+
# Set environment variables
5+
ENV DEBIAN_FRONTEND=noninteractive \
6+
PYTHONUNBUFFERED=1 \
7+
PYTHONDONTWRITEBYTECODE=1 \
8+
PYTHONPATH=/workspaces/Apim-Samples/shared/python:/workspaces/Apim-Samples
9+
10+
# Install everything we need in one layer
11+
RUN apt-get update && \
12+
apt-get install -y --no-install-recommends \
13+
# Core utilities (should already be in ubuntu, but just in case)
14+
coreutils \
15+
util-linux \
16+
findutils \
17+
grep \
18+
sed \
19+
curl \
20+
wget \
21+
jq \
22+
tree \
23+
git \
24+
git-lfs \
25+
# Python and dev tools
26+
python3.12 \
27+
python3.12-dev \
28+
python3.12-venv \
29+
python3-pip \
30+
# Additional utilities
31+
sudo \
32+
openssh-client \
33+
gnupg \
34+
lsb-release \
35+
ca-certificates && \
36+
# Clean up
37+
apt-get clean && \
38+
rm -rf /var/lib/apt/lists/* && \
39+
# Create vscode user
40+
groupadd --gid 1000 vscode && \
41+
useradd --uid 1000 --gid vscode --shell /bin/bash --create-home vscode && \
42+
echo "vscode ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && \
43+
# Set up Python
44+
ln -sf /usr/bin/python3.12 /usr/bin/python3 && \
45+
ln -sf /usr/bin/python3.12 /usr/bin/python && \
46+
python3 -m pip install --upgrade pip setuptools wheel && \
47+
# Verify core commands work
48+
which sleep && sleep 1 && echo "Sleep test passed" && \
49+
which cat && echo "test" | cat && echo "Cat test passed" && \
50+
which grep && echo "test" | grep "test" && echo "Grep test passed"
51+
52+
# Install Azure CLI
53+
RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash && \
54+
az config set core.login_experience_v2=off 2>/dev/null || true
55+
56+
# Switch to vscode user
57+
USER vscode
58+
WORKDIR /workspaces/Apim-Samples
59+
60+
# Final verification
61+
RUN echo "Container setup complete!" && \
62+
python3 --version && \
63+
az --version | head -n 3

.devcontainer/post-start-setup.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,31 @@ echo " 1. Log in via the Azure CLI: az login"
9292
echo " 2. Start using the infrastructures and samples!"
9393
echo ""
9494
echo "============================================================================"
95+
96+
# ------------------------------
97+
# CORE UTILITIES VERIFICATION
98+
# ------------------------------
99+
100+
echo "Core Utilities Status:"
101+
102+
# Test essential commands that should always be available
103+
if command -v sleep >/dev/null 2>&1; then
104+
echo " ✅ sleep command"
105+
else
106+
echo " ❌ sleep command missing - installing..."
107+
sudo apt-get update >/dev/null 2>&1 && sudo apt-get install -y coreutils >/dev/null 2>&1
108+
fi
109+
110+
if command -v cat >/dev/null 2>&1; then
111+
echo " ✅ cat command"
112+
else
113+
echo " ❌ cat command missing"
114+
fi
115+
116+
if command -v grep >/dev/null 2>&1; then
117+
echo " ✅ grep command"
118+
else
119+
echo " ❌ grep command missing"
120+
fi
121+
122+
echo ""

0 commit comments

Comments
 (0)