2024-10-29 08:35:06 +00:00
|
|
|
# Użyj najnowszego obrazu bazowego Debian
|
|
|
|
FROM debian:latest
|
|
|
|
|
2024-10-30 08:29:19 +00:00
|
|
|
# Ustaw zmienną środowiskową DEBIAN_FRONTEND na noninteractive
|
2024-10-29 08:35:06 +00:00
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
2024-10-30 08:29:19 +00:00
|
|
|
# Aktualizacja pakietów i instalacja wymaganych narzędzi
|
2024-10-29 08:35:06 +00:00
|
|
|
RUN apt-get update && apt-get install -y \
|
|
|
|
iproute2 \
|
|
|
|
curl \
|
|
|
|
vim \
|
|
|
|
tmux \
|
|
|
|
git \
|
|
|
|
htop \
|
|
|
|
mc \
|
|
|
|
sudo \
|
|
|
|
wget \
|
|
|
|
gnupg \
|
|
|
|
tcpdump \
|
|
|
|
termshark \
|
|
|
|
python3 \
|
|
|
|
python3-scapy \
|
|
|
|
iputils-ping \
|
|
|
|
traceroute \
|
2024-10-30 08:29:19 +00:00
|
|
|
ipcalc \
|
|
|
|
procps
|
2024-10-29 08:35:06 +00:00
|
|
|
|
|
|
|
# Ustawienie hasła dla użytkownika root
|
|
|
|
RUN echo "root:rootpass" | chpasswd
|
|
|
|
|
|
|
|
# Tworzenie nowego użytkownika 'user' z hasłem 'pass' i dodanie do grupy sudo
|
2024-10-30 08:29:19 +00:00
|
|
|
RUN id -u user 2>/dev/null || ( \
|
|
|
|
useradd -m -s /bin/bash user && \
|
2024-10-29 08:35:06 +00:00
|
|
|
echo "user:pass" | chpasswd && \
|
2024-10-30 08:29:19 +00:00
|
|
|
usermod -aG sudo user \
|
|
|
|
) && \
|
|
|
|
mkdir -p /home/user && \
|
|
|
|
chown -R user:user /home/user
|
2024-10-29 08:35:06 +00:00
|
|
|
|
2024-10-30 08:29:19 +00:00
|
|
|
# Skopiowanie aplikacji do folderu /home/user/work
|
|
|
|
COPY app /home/user/work
|
2024-10-29 08:35:06 +00:00
|
|
|
|
2024-10-30 08:29:19 +00:00
|
|
|
# Ustawienie katalogu roboczego
|
|
|
|
WORKDIR /home/user/work
|
|
|
|
|
|
|
|
# Ustawienie domyślnego użytkownika
|
|
|
|
USER user
|
|
|
|
|
2024-10-30 10:09:21 +00:00
|
|
|
# Ustawienie domyślnego polecenia - uruchomienie serwera HTTP na porcie 3333
|
2024-10-30 08:29:19 +00:00
|
|
|
CMD ["python3", "-m", "http.server", "3333"]
|
2024-10-29 08:35:06 +00:00
|
|
|
|