remainsalways commited on
Commit
f685895
·
verified ·
1 Parent(s): ca6a967

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -11
Dockerfile CHANGED
@@ -1,11 +1,13 @@
1
- # Use an official Ansible image or build from base
2
  FROM debian:bullseye-slim
3
 
 
 
4
  # Install required packages
5
  RUN apt-get update && apt-get install -y \
6
  git \
7
  ansible \
8
  sshpass \
 
9
  sudo \
10
  python3-pip \
11
  curl \
@@ -13,17 +15,18 @@ RUN apt-get update && apt-get install -y \
13
  && apt-get clean \
14
  && rm -rf /var/lib/apt/lists/*
15
 
16
- # Set working directory
17
- WORKDIR /ansible-nas
18
-
19
- # Clone the Ansible-NAS repo
20
- RUN git clone https://github.com/davestephens/ansible-nas.git .
21
 
22
- # Copy custom inventory (optional step – replace with your folder)
23
- # COPY ./inventories/my-ansible-nas inventories/my-ansible-nas
24
 
25
- # Install Galaxy roles
26
- RUN ansible-galaxy install -r requirements.yml
 
27
 
28
- # Default command to run playbook (change as needed)
29
  CMD ["ansible-playbook", "-i", "inventories/my-ansible-nas/inventory", "nas.yml", "-b"]
 
 
1
  FROM debian:bullseye-slim
2
 
3
+ ENV DEBIAN_FRONTEND=noninteractive
4
+
5
  # Install required packages
6
  RUN apt-get update && apt-get install -y \
7
  git \
8
  ansible \
9
  sshpass \
10
+ openssh-client \
11
  sudo \
12
  python3-pip \
13
  curl \
 
15
  && apt-get clean \
16
  && rm -rf /var/lib/apt/lists/*
17
 
18
+ # Create user and working directory with proper permissions
19
+ RUN groupadd -g 1000 ansible && \
20
+ useradd -m -u 1000 -g ansible ansible && \
21
+ mkdir -p /ansible-nas && \
22
+ chown -R ansible:ansible /ansible-nas
23
 
24
+ USER ansible
25
+ WORKDIR /ansible-nas
26
 
27
+ # Clone Ansible-NAS and set up environment
28
+ RUN git clone https://github.com/davestephens/ansible-nas.git . && \
29
+ ansible-galaxy install -r requirements.yml
30
 
31
+ # Default command override as needed on HF
32
  CMD ["ansible-playbook", "-i", "inventories/my-ansible-nas/inventory", "nas.yml", "-b"]