78 líneas
1.8 KiB
Docker
78 líneas
1.8 KiB
Docker
FROM ubuntu:22.04
|
|
|
|
# Metadata
|
|
LABEL maintainer="WoeUSB Docker Project"
|
|
LABEL description="WoeUSB - Microsoft Windows USB installation media preparer for GNU+Linux"
|
|
LABEL version="1.0"
|
|
|
|
# Prevent interactive prompts during package installation
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
# Install all required and optional dependencies
|
|
RUN apt-get update && \
|
|
apt-get install -y \
|
|
# Required dependencies
|
|
bash \
|
|
coreutils \
|
|
util-linux \
|
|
grep \
|
|
gawk \
|
|
findutils \
|
|
grub-pc-bin \
|
|
grub2-common \
|
|
parted \
|
|
wget \
|
|
dosfstools \
|
|
ntfs-3g \
|
|
wimtools \
|
|
# Optional dependencies
|
|
p7zip-full \
|
|
gettext \
|
|
# Additional useful tools
|
|
sudo \
|
|
udev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Create a non-root user for running the application
|
|
RUN useradd -m -s /bin/bash woeusb && \
|
|
echo "woeusb ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy WoeUSB files
|
|
COPY WoeUSB/ /app/
|
|
|
|
# Make the woeusb script executable
|
|
RUN chmod +x /app/sbin/woeusb
|
|
|
|
# Add woeusb to PATH
|
|
ENV PATH="/app/sbin:${PATH}"
|
|
|
|
# Create entrypoint script to setup loop devices
|
|
RUN echo '#!/bin/bash\n\
|
|
set -e\n\
|
|
# Create loop devices if they don'"'"'t exist (runs as root)\n\
|
|
for i in {0..7}; do\n\
|
|
if [ ! -b /dev/loop$i ]; then\n\
|
|
mknod /dev/loop$i b 7 $i 2>/dev/null || true\n\
|
|
fi\n\
|
|
done\n\
|
|
# Switch to woeusb user if running interactive shell\n\
|
|
if [ "$#" -eq 0 ] || [ "$1" = "/bin/bash" ]; then\n\
|
|
exec su - woeusb\n\
|
|
else\n\
|
|
# Execute command as is (allows sudo usage)\n\
|
|
exec "$@"\n\
|
|
fi\n' > /entrypoint.sh && \
|
|
chmod +x /entrypoint.sh
|
|
|
|
# Don't set default user - entrypoint runs as root to create loop devices
|
|
# USER woeusb
|
|
|
|
# Set entrypoint
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
|
|
# Default command
|
|
CMD ["/bin/bash"]
|