mentalnet-microcontainers/micro-fedora43-dev/Dockerfile
2025-11-23 19:02:38 -05:00

51 lines
1.9 KiB
Docker

FROM fedora:43
# Basic tools + SSH + dev stack (+ fastfetch if available)
RUN dnf -y update && \
dnf -y install \
openssh-server \
sudo \
ca-certificates \
git \
curl wget \
vim nano \
htop \
gcc gcc-c++ make \
fastfetch || true && \
dnf clean all && \
rm -rf /var/cache/dnf
# Create 'micro' user with fixed uid/gid 1000
RUN useradd -m -u 1000 -U -s /bin/bash micro && \
echo "micro:ChangeMe123" | chpasswd && \
usermod -aG wheel micro
# Prepare .ssh directory
RUN mkdir -p /home/micro/.ssh && \
chown -R micro:micro /home/micro && \
chmod 700 /home/micro/.ssh
# SSH server config: key-only login, use ~/.ssh/authorized_keys
RUN sed -i 's/^#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config || true && \
sed -i 's/^PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config || true && \
sed -i 's/^#KbdInteractiveAuthentication yes/KbdInteractiveAuthentication no/' /etc/ssh/sshd_config || true && \
sed -i 's/^#PubkeyAuthentication yes/PubkeyAuthentication yes/' /etc/ssh/sshd_config || true && \
sed -i 's|^#AuthorizedKeysFile.*|AuthorizedKeysFile .ssh/authorized_keys|' /etc/ssh/sshd_config || true && \
echo 'UsePAM no' >> /etc/ssh/sshd_config
# Generate host keys and make sure run dir exists
RUN mkdir -p /var/run/sshd && \
ssh-keygen -A
# Fastfetch config for micro (reuse your existing JSON)
RUN mkdir -p /home/micro/.config/fastfetch
COPY fastfetch_config.json /home/micro/.config/fastfetch/config.jsonc
RUN chown -R micro:micro /home/micro/.config && \
echo 'if command -v fastfetch >/dev/null 2>&1; then fastfetch; fi' >> /home/micro/.bashrc && \
echo 'alias fastfetch="fastfetch --config $HOME/.config/fastfetch/config.jsonc"' >> /home/micro/.bashrc && \
chown micro:micro /home/micro/.bashrc
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]