Skip to content

Commit 05e83f1

Browse files
authored
final
1 parent c98ec25 commit 05e83f1

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

Containerfile

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
FROM python:alpine AS builder
44

55
# Add configuration files
6-
COPY requirements/apk.build.list requirements/pip.list /requirements/ansible.yaml /requirements/
6+
COPY requirements/apk.build.list /requirements/ansible.yaml /requirements/
77

88
# Overridable args to pass to galaxy role/collection install
99
ARG ANSIBLE_GALAXY_CLI_ROLE_OPTS=
@@ -12,7 +12,6 @@ ARG ANSIBLE_GALAXY_CLI_COLLECTION_OPTS=
1212
# Install system build dependencies
1313
RUN apk add --no-cache $(cat /requirements/apk.build.list) && \
1414
python -m venv /opt/ansible_venv/ && PATH=/opt/ansible_venv/bin:${PATH} \
15-
pip install --no-cache-dir --requirement requirements/pip.list && \
1615
ansible-galaxy role install ${ANSIBLE_GALAXY_CLI_ROLE_OPTS} \
1716
--role-file /requirements/ansible.yaml \
1817
--roles-path "/usr/share/ansible/roles" && \
@@ -22,7 +21,7 @@ RUN apk add --no-cache $(cat /requirements/apk.build.list) && \
2221
chmod -R a=rX /usr/share/ansible
2322

2423
######################################### RUNNER #########################################
25-
24+
2625
FROM python:alpine
2726

2827
LABEL org.opencontainers.image.description="A really small Ansible Execution Environment that is easily customizable and maintainable withoud using the bloated ansible-builder ;)"
@@ -31,23 +30,23 @@ LABEL org.opencontainers.image.description="A really small Ansible Execution Env
3130
WORKDIR /runner/
3231

3332
# Add runtime dependencies lists
34-
COPY requirements/apk.list /requirements/
35-
# Copy install pip modules and Ansible roles and collections
36-
COPY --from=builder /opt/ansible_venv/ /opt/ansible_venv/
33+
COPY requirements/apk.list requirements/pip.list /requirements/
34+
# Copy Ansible roles and collections
3735
COPY --from=builder /usr/share/ansible /usr/share/ansible
3836

3937
# Add non-root user
4038
ARG USER=ansible && \
4139
GROUP=ansible && \
4240
UID=1000 && \
4341
GID=1000
42+
# Make the user, install packages, pip modules and make the python interpeter system default
4443
RUN addgroup ${GROUP} --gid ${GID} && \
4544
adduser ${USER} --uid ${UID} \
4645
--ingroup "${GROUP}" \
4746
--disabled-password && \
4847
chown ${USER}:${GROUP} /runner/ /home/"${USER}"/ && \
4948
apk add --no-cache $(cat /requirements/apk.list) && \
50-
pip install --no-cache-dir ansible-core && \
49+
pip install --no-cache-dir --requirement requirements/pip.list && \
5150
ln -s /usr/local/bin/python3 /usr/bin/python3
5251

5352
# Set user and Ansible required args/paths

requirements/apk.list

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
openssh-client
2-
sshpass
2+
sshpass

0 commit comments

Comments
 (0)