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

docker: Add docker buildx functionality to dockernode playbook for arm32 containers #3601

Merged
merged 8 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ The `dockerhost.yml` playbook can deploy single, multiple and duplicate containe

will deploy 1 Ubuntu 22.04 container, 1 Alpine 3.19 container and 3 Ubuntu 18.04 containers.

If you would like to build an arm32 container on an arm64 dockerhost, pass the `build_arm` variable:

```
ansible-playbook -u root -i <host-file> AdoptOpenJDK_Unix_Playbook
/dockernode.yml -t "deploy" -e "docker_images=u2204 build_arm=yes"
Haroon-Khel marked this conversation as resolved.
Show resolved Hide resolved
```

## Setting up a new DockerStatic container (manually)

If you would like to setup an individual container on one of these machines, follow these instructions:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
---

- name: Set docker build command
set_fact:
docker_build_command: "docker build"
arm_suffix: ""

- name: Set docker buildx command if building arm container
set_fact:
docker_build_command: "docker buildx build --platform linux/v7/arm"
arm_suffix: ".ARM32"
ansible_architecture: arm
when: build_arm is defined and build_arm == "yes"

# Dockerfiles are transferred from the controller node onto the dockerhost to be used to build and run docker containers
- name: Transfer dockerfile
copy:
Expand All @@ -19,8 +32,8 @@
regexp: "Jenkins_User_SSHKey"
replace: "{{ Jenkins_User_SSHKey }}"

- name: Build {{ docker_image }} docker images
command: docker build --cpu-period=100000 --cpu-quota=800000 -t aqa_{{ docker_image }} --memory=6G -f /tmp/Dockerfile.{{ docker_image }} /tmp/
- name: Build {{ docker_image }} docker images {{ docker_build_command }}
command: "{{ docker_build_command }} --cpu-period=100000 --cpu-quota=800000 -t aqa_{{ docker_image }}{{ arm_suffix }} --memory=6G -f /tmp/Dockerfile.{{ docker_image }} /tmp/"

# Finds the highest port number already assigned and +1
- name: Find available port
Expand All @@ -38,4 +51,4 @@
when: not (docker_port_output.stdout == "")

- name: Run {{ docker_image }} docker container
command: docker run --restart unless-stopped -p {{ docker_port }}:22 --cpuset-cpus="0-3" --memory=6G --detach --name {{ docker_image | upper }}.{{ docker_port }} aqa_{{ docker_image }}
command: docker run --restart unless-stopped -p {{ docker_port }}:22 --cpuset-cpus="0-3" --memory=6G --detach --name {{ docker_image | upper }}.{{ docker_port }}{{ arm_suffix }} aqa_{{ docker_image }}{{ arm_suffix }}
Loading