Skip to content

Commit b249ded

Browse files
committed
fix: install ansible galaxy deps as ansible user
1 parent de9e570 commit b249ded

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

Dockerfile

+20-12
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,19 @@ ENV PYTHONUNBUFFERED=1 \
66
LC_ALL="C.UTF-8" \
77
LC_CTYPE="C.UTF-8"
88

9+
# Create app directory
10+
RUN set -eux; \
11+
mkdir /app
12+
WORKDIR /app
13+
14+
# Create user for ssh
15+
RUN <<EOF
16+
set -eux
17+
useradd -m ansible
18+
mkdir -p /home/ansible/.ssh
19+
chown -R ansible:ansible /home/ansible/.ssh
20+
EOF
21+
922
# Install runtime dependencies
1023
RUN <<EOF
1124
set -eux
@@ -14,21 +27,16 @@ RUN <<EOF
1427
rm -rf /var/lib/apt/lists/*
1528
EOF
1629

17-
# Install ansible dependencies
30+
# Install python dependencies
1831
COPY overlay/ /
1932
RUN <<EOF
2033
set -eux
2134
pip install -r /opt/buildpack/requirements.txt
22-
ansible-galaxy collection install -r /opt/buildpack/requirements.yaml
2335
EOF
2436

25-
# Create app directory
26-
RUN set -eux; \
27-
mkdir /app
28-
WORKDIR /app
29-
30-
# Create user for ssh
31-
RUN useradd -m ansible
32-
RUN mkdir -p /home/ansible/.ssh
33-
RUN chown -R ansible:ansible /home/ansible/.ssh
34-
USER ansible
37+
# Install ansible dependencies
38+
USER ansible
39+
RUN <<EOF
40+
set -eux
41+
ansible-galaxy collection install -r /opt/buildpack/requirements.yaml
42+
EOF

0 commit comments

Comments
 (0)