Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AAP-15000: Changes to container image to reduce overall size #575

Merged
merged 3 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/image-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ runs:
- name: Run tests
shell: bash
run: >
docker run --rm -u 0 localhost/ansible-rulebook:test bash -c '
docker run --rm localhost/ansible-rulebook:test bash -c '
pip install -r requirements_test.txt &&
pytest -m "e2e" -n auto'
19 changes: 11 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
FROM registry.access.redhat.com/ubi8/python-39
FROM quay.io/centos/centos:stream9-development
Alex-Izquierdo marked this conversation as resolved.
Show resolved Hide resolved

ARG USER_ID=${USER_ID:-1001}
ARG APP_DIR=${APP_DIR:-/app}
ARG DEVEL_COLLECTION_LIBRARY=0
ARG DEVEL_COLLECTION_REPO=git+https://github.com/ansible/event-driven-ansible.git
WORKDIR $HOME

USER 0
RUN dnf install -y java-17-openjdk-devel
RUN useradd -u $USER_ID -d $APP_DIR appuser
WORKDIR $APP_DIR
COPY . $WORKDIR
Alex-Izquierdo marked this conversation as resolved.
Show resolved Hide resolved
RUN chown -R $USER_ID $APP_DIR
RUN dnf install -y java-17-openjdk-devel python3-pip

USER $USER_ID
ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk
ENV PATH="${PATH}:$APP_DIR/.local/bin"
RUN pip install -U pip \
&& pip install ansible \
&& pip install ansible-core \
Alex-Izquierdo marked this conversation as resolved.
Show resolved Hide resolved
ansible-runner \
jmespath \
asyncio \
Expand All @@ -22,8 +29,4 @@ RUN pip install -U pip \
RUN bash -c "if [ $DEVEL_COLLECTION_LIBRARY -ne 0 ]; then \
ansible-galaxy collection install ${DEVEL_COLLECTION_REPO} --force; fi"

COPY . $WORKDIR
RUN chown -R $USER_ID ./

USER $USER_ID
RUN pip install .