removed apt simulation doing now real apt updates/install

This commit is contained in:
2026-02-15 18:18:30 +01:00
parent bc1e17ec04
commit 34d6707ba3
4 changed files with 13 additions and 41 deletions
+4 -33
View File
@@ -1,41 +1,12 @@
FROM ubuntu:22.04
# Minimal image for safe simulation of apt installs.
# Install required utilities including sudo
RUN apt-get update && apt-get install -y --no-install-recommends \
bash wget tar curl gnupg ca-certificates apt-utils apt coreutils file procps && \
bash wget tar curl gnupg ca-certificates apt-utils apt coreutils file procps sudo && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# sudo wrapper: simulate apt installs and avoid making changes to the image
RUN cat > /usr/local/bin/sudo <<'EOF'
#!/bin/sh
# sudo wrapper for simulation:
# - simulate installs with `apt-get -s install ...`
# - run `apt-get update` quietly (needed so apt -s has metadata)
# - otherwise echo the command (no-op)
cmd="$1"
arg2="${2:-}"
if [ "$cmd" = "apt" ] || [ "$cmd" = "apt-get" ]; then
if [ "$arg2" = "install" ]; then
shift 2
echo "[sudo-wrapper] simulating: apt-get -s install $@"
apt-get -s install "$@"
exit $?
elif [ "$arg2" = "update" ]; then
# do not run update at runtime (may require extra privileges); simulate instead
echo "[sudo-wrapper] simulating: apt-get update (no-op in container)"
exit 0
else
echo "[sudo-wrapper] would run: $@"
exit 0
fi
else
echo "[sudo-wrapper] would run: $@"
exit 0
fi
EOF
RUN chmod +x /usr/local/bin/sudo
ENV PATH=/usr/local/bin:$PATH
# Configure passwordless sudo for all users (needed for script)
RUN echo 'ALL ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
WORKDIR /workspace
ENTRYPOINT ["/bin/bash"]