Files
DevOpsLab/dockerfiles/astra-linux/Dockerfile
Сергей Антропов fadca7c322 fix: исправлены Dockerfile для systemd и molecule для тестирования
- Исправлены все Dockerfile (удален USER ansible перед CMD)
  Причина: systemd должен запускаться от root (PID 1)

- Исправлены параметры в molecule/default/create.yml
  (environment → env для модуля community.docker.docker_container)

- Добавлен -u root в Makefile для запуска контейнера
- Добавлена переменная MOLECULE_EPHEMERAL_DIRECTORY

- Удалена роль nginx из deploy.yml (не существует)

Автор: Сергей Антропов
Сайт: https://devops.org.ru
2025-10-25 17:29:41 +03:00

58 lines
2.0 KiB
Docker
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Astra Linux с systemd
# Автор: Сергей Антропов
# Сайт: https://devops.org.ru
# https://registry.astralinux.ru/browse/library/
FROM registry.astralinux.ru/library/astra/ubi17:1.7.6.uu2
# Обновляем систему
RUN apt-get update && apt-get dist-upgrade -y
# Устанавливаем systemd и необходимые пакеты
RUN apt-get install -y \
systemd \
systemd-sysv \
dbus \
curl \
wget \
git \
vim \
nano \
htop \
tree \
jq \
python3 \
python3-pip \
&& apt-get clean
# Устанавливаем yq
RUN wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_arm64 \
&& chmod +x /usr/local/bin/yq
# Устанавливаем Docker вручную для AstraLinux
RUN apt-get update && apt-get install -y \
ca-certificates \
curl \
gnupg \
lsb-release \
&& mkdir -p /usr/share/keyrings \
&& curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg \
&& echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian buster stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null \
&& apt-get update \
&& apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin \
&& apt-get clean
# Устанавливаем Docker Compose
RUN curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose \
&& chmod +x /usr/local/bin/docker-compose
# Настраиваем systemd
RUN systemctl set-default multi-user.target
# Создаем пользователя для Ansible
RUN useradd -m -s /bin/bash ansible \
&& echo "ansible ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
# Команда по умолчанию (система запускается от root для systemd)
CMD ["/sbin/init"]