mirror of
https://github.com/acedanger/shell.git
synced 2025-12-06 06:40:13 -08:00
81 lines
3.0 KiB
Docker
81 lines
3.0 KiB
Docker
# Dockerfile to test bootstrap.sh and setup.sh scripts in different environments
|
|
# This allows testing the setup process in isolated containers
|
|
|
|
# Ubuntu test environment
|
|
FROM ubuntu:24.04 as ubuntu-test
|
|
LABEL description="Ubuntu test environment for shell setup scripts"
|
|
|
|
# Install minimal dependencies needed to run the test
|
|
ENV TZ=America/New_York
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
ARG APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1
|
|
|
|
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
|
|
&& apt-get update && apt-get install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confnew" -y curl git sudo wget
|
|
|
|
# Pre-install cowsay and lolcat packages for testing
|
|
RUN apt-get update && apt-get install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confnew" -y cowsay lolcat
|
|
|
|
# Create logs directory with proper permissions
|
|
RUN mkdir -p /logs && chmod -R 777 /logs
|
|
|
|
# Create a test user with sudo permissions
|
|
RUN useradd -ms /bin/bash testuser && \
|
|
echo "testuser ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/testuser
|
|
|
|
USER testuser
|
|
WORKDIR /home/testuser
|
|
|
|
# Create directory structure for shell setup
|
|
RUN mkdir -p /home/testuser/shell/setup
|
|
|
|
# Copy test script, startup script, and packages.list
|
|
COPY --chown=testuser:testuser test-setup.sh /home/testuser/
|
|
COPY --chown=testuser:testuser startup.sh /home/testuser/
|
|
COPY --chown=testuser:testuser packages.list /home/testuser/shell/
|
|
|
|
# Make scripts executable
|
|
RUN chmod +x /home/testuser/test-setup.sh
|
|
RUN chmod +x /home/testuser/startup.sh
|
|
|
|
CMD ["/bin/bash", "-c", "./startup.sh"]
|
|
|
|
# Debian test environment
|
|
FROM debian:12 as debian-test
|
|
LABEL description="Debian test environment for shell setup scripts"
|
|
|
|
# Install minimal dependencies needed to run the test
|
|
ENV TZ=America/New_York
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
ARG APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1
|
|
|
|
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
|
|
&& apt-get update && apt-get install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confnew" -y curl git sudo wget
|
|
|
|
# Pre-install cowsay and lolcat packages for testing
|
|
RUN apt-get update && apt-get install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confnew" -y cowsay lolcat
|
|
|
|
# Create logs directory with proper permissions
|
|
RUN mkdir -p /logs && chmod -R 777 /logs
|
|
|
|
# Create a test user with sudo permissions
|
|
RUN useradd -ms /bin/bash testuser && \
|
|
echo "testuser ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/testuser
|
|
|
|
USER testuser
|
|
WORKDIR /home/testuser
|
|
|
|
# Create directory structure for shell setup
|
|
RUN mkdir -p /home/testuser/shell/setup
|
|
|
|
# Copy test script, startup script, and packages.list
|
|
COPY --chown=testuser:testuser test-setup.sh /home/testuser/
|
|
COPY --chown=testuser:testuser startup.sh /home/testuser/
|
|
COPY --chown=testuser:testuser packages.list /home/testuser/shell/
|
|
|
|
# Make scripts executable
|
|
RUN chmod +x /home/testuser/test-setup.sh
|
|
RUN chmod +x /home/testuser/startup.sh
|
|
|
|
CMD ["/bin/bash", "-c", "./startup.sh"]
|