forked from EnterpriseDB/tpa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TPA-708: merge tpaexec-ee repo to tpa-internal
Change to the github workflow that builds tpa-ee docker image to use the new folders (tpa-ee/aap24/{rhel,alpine})instead of tpaexec-ee Changes to the execution-environment.yml files to be used from their new location Changes to dockerignore file to reduce weight of docker image Changes to the script.sh that was not being actively used, it now can be used to generate an image for both base-image. Add README.md files to give user more information about the usage of these files.
- Loading branch information
1 parent
36e706e
commit 9cc8242
Showing
11 changed files
with
540 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,33 @@ | ||
.git | ||
requirements*.in | ||
requirements | ||
*.pyc | ||
.env | ||
.tox | ||
.coverage | ||
nosetests.xml | ||
coverage.xml | ||
*.log | ||
.git | ||
.github | ||
tox.ini | ||
sonar-project.properties | ||
runtime.txt | ||
pyrightconfig.json | ||
Dockerfile | ||
.yamllint.yaml | ||
.prospector.yaml | ||
.idea | ||
.gitignore | ||
.gitattributes | ||
.git-ignore-revs | ||
.editorconfig | ||
.dockerignore | ||
.coveragerc | ||
.ansible-lint | ||
.actrc | ||
docs | ||
tpa-ee | ||
tpa-venv | ||
relnotes | ||
release_notes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,83 @@ | ||
# © Copyright EnterpriseDB UK Limited 2015-2024 - All rights reserved. | ||
|
||
# Build this container image like this | ||
# | ||
# docker build -t tpaexec:$(git describe --tags) -t tpaexec:latest . | ||
|
||
# To use the container image, create a shell alias like this | ||
# | ||
# alias tpaexec="docker run --rm -v $PWD:/work -v $HOME/.git:/root/.git -v $HOME/.gitconfig:/root/.gitconfig \ | ||
# -v /var/run/docker.sock:/var/run/docker.sock \ | ||
# -e USER_ID=$(id -u) -e GROUP_ID=$(id -g) tpaexec" | ||
# | ||
# Then run commands like this | ||
# | ||
# tpaexec configure cluster -a M1 --postgresql 15 --failover-manager patroni --platform docker | ||
# tpaexec deploy cluster | ||
|
||
FROM debian:bookworm-slim | ||
|
||
LABEL maintainer="EDB <[email protected]>" | ||
|
||
# Copy tpaexec sources from the current directory into the image | ||
ENV TPA_DIR=/opt/EDB/TPA | ||
|
||
COPY . ${TPA_DIR} | ||
|
||
# Set up repositories and install packages, including the Docker CE CLI | ||
# (https://docs.docker.com/engine/install/debian/). | ||
|
||
RUN apt-get -y update && \ | ||
apt-get -y install --no-install-recommends \ | ||
curl gnupg apt-transport-https \ | ||
python3 python3-dev python3-pip python3-venv \ | ||
openvpn patch git gcc && \ | ||
curl -fsSL https://download.docker.com/linux/debian/gpg >/etc/apt/trusted.gpg.d/docker.asc && \ | ||
codename=$(awk -F= '/VERSION_CODENAME/{print $2}' /etc/os-release) && \ | ||
arch=$(dpkg --print-architecture) && \ | ||
echo "deb [arch=$arch] https://download.docker.com/linux/debian $codename stable" \ | ||
>/etc/apt/sources.list.d/docker.list && \ | ||
apt-get -y update && \ | ||
apt-get -y install --no-install-recommends docker-ce-cli && \ | ||
\ | ||
# run `tpaexec setup` to complete the installation, and then `tpaexec selftest` to verify it. \ | ||
\ | ||
ln -sf ${TPA_DIR}/bin/tpaexec /usr/local/bin && \ | ||
mkdir /opt/2ndQuadrant/ && \ | ||
ln -sf ${TPA_DIR} /opt/2ndQuadrant/TPA && \ | ||
tpaexec setup --use-community-ansible && \ | ||
tpaexec selftest && \ | ||
(cd "${TPA_DIR}" && git describe --tags >VERSION) && \ | ||
\ | ||
# Clean up unnecessary files and packages \ | ||
\ | ||
rm -rf ${TPA_DIR}/.[a-z]* && \ | ||
apt purge -y gcc python3-dev python3-pip python3-venv build-essential && \ | ||
apt autoremove -y && \ | ||
apt autoclean -y && \ | ||
apt clean -y && \ | ||
rm -rf /var/cache/apt /var/lib/apt/lists | ||
|
||
WORKDIR /work | ||
CMD ["--help"] | ||
ENTRYPOINT ["/opt/EDB/TPA/entrypoint.sh"] | ||
ARG EE_BASE_IMAGE="registry.redhat.io/ansible-automation-platform-24/ee-minimal-rhel9:latest" | ||
ARG PYCMD="/usr/bin/python3" | ||
ARG PKGMGR_PRESERVE_CACHE="" | ||
ARG ANSIBLE_GALAXY_CLI_COLLECTION_OPTS="" | ||
ARG ANSIBLE_GALAXY_CLI_ROLE_OPTS="" | ||
ARG PKGMGR="/usr/bin/microdnf" | ||
|
||
# Base build stage | ||
FROM $EE_BASE_IMAGE as base | ||
USER root | ||
ARG EE_BASE_IMAGE | ||
ARG PYCMD | ||
ARG PKGMGR_PRESERVE_CACHE | ||
ARG ANSIBLE_GALAXY_CLI_COLLECTION_OPTS | ||
ARG ANSIBLE_GALAXY_CLI_ROLE_OPTS | ||
ARG PKGMGR | ||
|
||
RUN $PYCMD -m ensurepip | ||
COPY _build/scripts/ /output/scripts/ | ||
COPY _build/scripts/entrypoint /opt/builder/bin/entrypoint | ||
|
||
# Galaxy build stage | ||
FROM base as galaxy | ||
ARG EE_BASE_IMAGE | ||
ARG PYCMD | ||
ARG PKGMGR_PRESERVE_CACHE | ||
ARG ANSIBLE_GALAXY_CLI_COLLECTION_OPTS | ||
ARG ANSIBLE_GALAXY_CLI_ROLE_OPTS | ||
ARG PKGMGR | ||
|
||
RUN /output/scripts/check_galaxy | ||
COPY _build /build | ||
WORKDIR /build | ||
|
||
RUN ansible-galaxy role install $ANSIBLE_GALAXY_CLI_ROLE_OPTS -r requirements.yml --roles-path "/usr/share/ansible/roles" | ||
RUN ANSIBLE_GALAXY_DISABLE_GPG_VERIFY=1 ansible-galaxy collection install $ANSIBLE_GALAXY_CLI_COLLECTION_OPTS -r requirements.yml --collections-path "/usr/share/ansible/collections" | ||
|
||
# Builder build stage | ||
FROM base as builder | ||
WORKDIR /build | ||
ARG EE_BASE_IMAGE | ||
ARG PYCMD | ||
ARG PKGMGR_PRESERVE_CACHE | ||
ARG ANSIBLE_GALAXY_CLI_COLLECTION_OPTS | ||
ARG ANSIBLE_GALAXY_CLI_ROLE_OPTS | ||
ARG PKGMGR | ||
|
||
RUN $PYCMD -m pip install --no-cache-dir bindep pyyaml requirements-parser | ||
|
||
COPY --from=galaxy /usr/share/ansible /usr/share/ansible | ||
|
||
COPY _build/requirements.txt requirements.txt | ||
RUN $PYCMD /output/scripts/introspect.py introspect --sanitize --user-pip=requirements.txt --write-bindep=/tmp/src/bindep.txt --write-pip=/tmp/src/requirements.txt | ||
RUN /output/scripts/assemble | ||
|
||
# Final build stage | ||
FROM base as final | ||
ARG EE_BASE_IMAGE | ||
ARG PYCMD | ||
ARG PKGMGR_PRESERVE_CACHE | ||
ARG ANSIBLE_GALAXY_CLI_COLLECTION_OPTS | ||
ARG ANSIBLE_GALAXY_CLI_ROLE_OPTS | ||
ARG PKGMGR | ||
|
||
RUN /output/scripts/check_ansible $PYCMD | ||
|
||
COPY --from=galaxy /usr/share/ansible /usr/share/ansible | ||
|
||
COPY --from=builder /output/ /output/ | ||
RUN /output/scripts/install-from-bindep && rm -rf /output/wheels | ||
RUN chmod ug+rw /etc/passwd | ||
RUN mkdir -p /runner && chgrp 0 /runner && chmod -R ug+rwx /runner | ||
WORKDIR /runner | ||
RUN $PYCMD -m pip install --no-cache-dir 'dumb-init==1.2.5' | ||
RUN mkdir -p /opt/EDB/TPA | ||
RUN ls . -als | ||
COPY . /opt/EDB/TPA | ||
ENV PYTHONPATH="${PYTHONPATH:+${PYTHONPATH}:}/opt/EDB/TPA/lib" | ||
RUN rm -rf /output | ||
LABEL ansible-execution-environment=true | ||
USER 1000 | ||
ENTRYPOINT ["/opt/builder/bin/entrypoint", "dumb-init"] | ||
CMD ["bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Generate a RhedHat based TPA compatible Execution environment Image | ||
|
||
## the objective | ||
|
||
The objective is to generate an execution environment containing all the requirement | ||
for TPA to run deployments of bare platform using Ansible Automation Platform 2.4. | ||
|
||
The basic requirements to achieve this are: | ||
|
||
- python 3.19 installed and configured | ||
- ansible-runner | ||
- ansible-core-2.15 | ||
- TPA source code at the correct tag reference (matching the version you have installed or plan on using on your workstation). | ||
|
||
## python:3.9-alpine3.19 as base image | ||
|
||
python 3.9 pre-installed and configured. | ||
smallest and most up to date security wise. | ||
|
||
## requirements | ||
|
||
Building an execution image requires the following environment: | ||
|
||
python | ||
ansible-builder | ||
ansible-navigator | ||
|
||
|
||
## environment file | ||
|
||
tpa-exec-ee.yml | ||
|
||
## .dockerignore file | ||
|
||
lists files part of TPA repo that is not required for the EE image | ||
|
||
## Build the image | ||
|
||
build.sh script | ||
|
||
```bash | ||
./build.sh --tag registry_address/namespace/tpa-ee:vA.B.C | ||
``` | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#build_arg_defaults: | ||
# # redhat minimal EE image using redhat9 and ansible-core 2.15 | ||
# EE_BASE_IMAGE: 'registry.redhat.io/ansible-automation-platform-24/ee-minimal-rhel9:latest' | ||
# # redhat EE image + redhat supported collections using redhat9 and ansible-core 2.15 | ||
# #EE_BASE_IMAGE: 'registry.redhat.io/ansible-automation-platform-24/ee-supported-rhel9:latest' | ||
# # redhat EE image using redhat8 and ansible-core 2.9 | ||
# #EE_BASE_IMAGE: 'registry.redhat.io/ansible-automation-platform-24/ee-29-rhel8:latest' | ||
|
||
version: 3 | ||
images: | ||
base_image: | ||
name: 'python:3.9-alpine3.19' | ||
dependencies: | ||
python_interpreter: | ||
python_path: /usr/local/bin/python3 | ||
ansible_core: | ||
package_pip: ansible-core==2.15.* | ||
ansible_runner: | ||
package_pip: ansible-runner | ||
python: ../../../requirements-aap.txt | ||
galaxy: ../../../collections/requirements.yml | ||
options: | ||
package_manager_path: /sbin/apk | ||
build_arg_defaults: | ||
PKGMGR_PRESERVE_CACHE: 'always' | ||
additional_build_steps: | ||
prepend_base: | ||
- RUN $PKGMGR upgrade && $PKGMGR add bash openssh gcc build-base linux-headers libexpat && $PKGMGR cache clean && rm -f /var/cache/apk/* | ||
- RUN $PYCMD -m pip install --upgrade pip | ||
|
||
append_final: | ||
- RUN mkdir -p /opt/EDB/TPA | ||
- COPY . /opt/EDB/TPA | ||
- ENV PYTHONPATH="${PYTHONPATH:+${PYTHONPATH}:}/opt/EDB/TPA/lib" | ||
- RUN $PKGMGR cache clean && rm -f /var/cache/apk/* | ||
- RUN $PYCMD -m pip cache purge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
ansible-navigator | ||
ansible-builder | ||
|
Oops, something went wrong.