Skip to content

Commit

Permalink
fix: install ansible galaxy deps as ansible user
Browse files Browse the repository at this point in the history
  • Loading branch information
wastrachan committed Jan 30, 2024
1 parent de9e570 commit b249ded
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ ENV PYTHONUNBUFFERED=1 \
LC_ALL="C.UTF-8" \
LC_CTYPE="C.UTF-8"

# Create app directory
RUN set -eux; \
mkdir /app
WORKDIR /app

# Create user for ssh
RUN <<EOF
set -eux
useradd -m ansible
mkdir -p /home/ansible/.ssh
chown -R ansible:ansible /home/ansible/.ssh
EOF

# Install runtime dependencies
RUN <<EOF
set -eux
Expand All @@ -14,21 +27,16 @@ RUN <<EOF
rm -rf /var/lib/apt/lists/*
EOF

# Install ansible dependencies
# Install python dependencies
COPY overlay/ /
RUN <<EOF
set -eux
pip install -r /opt/buildpack/requirements.txt
ansible-galaxy collection install -r /opt/buildpack/requirements.yaml
EOF

# Create app directory
RUN set -eux; \
mkdir /app
WORKDIR /app

# Create user for ssh
RUN useradd -m ansible
RUN mkdir -p /home/ansible/.ssh
RUN chown -R ansible:ansible /home/ansible/.ssh
USER ansible
# Install ansible dependencies
USER ansible
RUN <<EOF
set -eux
ansible-galaxy collection install -r /opt/buildpack/requirements.yaml
EOF

0 comments on commit b249ded

Please sign in to comment.