Skip to content

Commit

Permalink
#167 fix JAVA_HOME env variable not setting accordingly to architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonio Arenzana Pulido committed Feb 1, 2022
1 parent 334f59c commit 9b84773
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a ch
### Added
- *[#160](https://github.com/idealista/java_role/issues/160) Remove packer for playbook for the task of pushing images to Dockerhub* @aren-pulid0
- *[#165](https://github.com/idealista/java_role/issues/165) Add JAVA_HOME as ENV in docker image* @aren-pulid0
- *[#167](https://github.com/idealista/java_role/issues/167) Support for multiarch images* @aren-pulid0

## [7.0.2](https://github.com/idealista/java_role/tree/7.0.2) (2021-08-19)
[Full Changelog](https://github.com/idealista/java_role/compare/7.0.1...7.0.2)
Expand Down
4 changes: 4 additions & 0 deletions dockerhub/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
FROM {{ docker_image_base }}

RUN rm -rf /var/lib/apt/lists/* && apt-get update \
&& apt-get install -y sudo systemd init systemd-sysv \
&& apt-get autoremove -y && apt-get clean

RUN mkdir -p /usr/share/man/man1

RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python3 sudo bash ca-certificates && apt-get clean; \
Expand Down
1 change: 1 addition & 0 deletions dockerhub/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

- name: Create builder
command: docker buildx create --name multiarch --driver docker-container --use
ignore_errors: true

- name: Use builder
command: docker buildx inspect --bootstrap
Expand Down
12 changes: 10 additions & 2 deletions tasks/install_openjdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,17 @@
java_required_key_repositories_openjdk: "{{ java_required_key_repositories_openjdk if java_required_key_repositories_openjdk is defined and java_required_key_repositories_openjdk is not sameas None and java_required_key_repositories_openjdk|length else __java_required_key_repositories_openjdk }}" # noqa 204
java_required_libs_openjdk: "{{ java_required_libs_openjdk if java_required_libs_openjdk is defined and java_required_libs_openjdk is not sameas None and java_required_libs_openjdk|length else __java_required_libs_openjdk }}" # noqa 204

- name: Java | Setting OS specific variables (II)
- name: Java | Setting OS and architecture specific variables (II)
set_fact:
java_open_jdk_home_dir: "{{ java_open_jdk_home_dir if java_open_jdk_home_dir is defined and java_open_jdk_home_dir is not sameas None and java_open_jdk_home_dir else __java_open_jdk_home_dir }}" # noqa 204
java_open_jdk_home_dir: |-
{% if ansible_facts.architecture == "x86_64" %}
{{ java_open_jdk_home_dir if java_open_jdk_home_dir is defined and java_open_jdk_home_dir is not sameas None and java_open_jdk_home_dir else __java_open_jdk_home_dir }}
{%- endif %}
{%- if ansible_facts.architecture == "aarch64" and (ansible_distribution == "Debian" or ansible_distribution == "Ubuntu") and (java_jdk_vendor == "adoptopenjdk" or java_jdk_vendor == "openjdk") %}
{{ java_open_jdk_home_dir if java_open_jdk_home_dir is defined and java_open_jdk_home_dir is not sameas None and java_open_jdk_home_dir else __java_open_jdk_home_dir_arm64 }}
{%- endif %}
java_open_jdk_package: "{{ java_open_jdk_package if java_open_jdk_package is defined and java_open_jdk_package is not sameas None and java_open_jdk_package else __java_open_jdk_package }}" # noqa 204

- name: Java | Setting specific variables
Expand Down
1 change: 1 addition & 0 deletions vars/adoptopenjdk/Debian-10.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ __java_required_libs_openjdk: []
__java_required_repositories_openjdk:
- deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ {{ ansible_distribution_release }} main
__java_open_jdk_home_dir: adoptopenjdk-{{ java_open_jdk_version_major }}-hotspot-amd64
__java_open_jdk_home_dir_arm64: adoptopenjdk-{{ java_open_jdk_version_major }}-hotspot-arm64

__java_required_key_repositories_openjdk:
- https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public
Expand Down
1 change: 1 addition & 0 deletions vars/adoptopenjdk/Debian-11.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ __java_required_libs_openjdk: []
__java_required_repositories_openjdk:
- deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ {{ ansible_distribution_release }} main
__java_open_jdk_home_dir: adoptopenjdk-{{ java_open_jdk_version_major }}-hotspot-amd64
__java_open_jdk_home_dir_arm64: adoptopenjdk-{{ java_open_jdk_version_major }}-hotspot-arm64

__java_required_key_repositories_openjdk:
- https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public
Expand Down
1 change: 1 addition & 0 deletions vars/openjdk/Debian-10.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ __java_required_key_repositories_openjdk: []

__java_open_jdk_package: openjdk-{{ java_open_jdk_version_major }}-jdk-headless
__java_open_jdk_home_dir: java-{{ java_open_jdk_version_major }}-openjdk-amd64
__java_open_jdk_home_dir_arm64: java-{{ java_open_jdk_version_major }}-openjdk-arm64
1 change: 1 addition & 0 deletions vars/openjdk/Debian-11.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ __java_open_jdk_apt_extra_packages: []

__java_open_jdk_package: openjdk-{{ java_open_jdk_version_major }}-jdk-headless
__java_open_jdk_home_dir: java-{{ java_open_jdk_version_major }}-openjdk-amd64
__java_open_jdk_home_dir_arm64: java-{{ java_open_jdk_version_major }}-openjdk-arm64

ansible_python_interpreter: /usr/bin/python3
1 change: 1 addition & 0 deletions vars/openjdk/Debian-9.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ __java_required_key_repositories_openjdk: []

__java_open_jdk_package: openjdk-{{ java_open_jdk_version_major }}-jdk-headless
__java_open_jdk_home_dir: java-{{ java_open_jdk_version_major }}-openjdk-amd64
__java_open_jdk_home_dir_arm64: java-{{ java_open_jdk_version_major }}-openjdk-arm64
1 change: 1 addition & 0 deletions vars/openjdk/Ubuntu-16.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ __java_required_key_repositories_openjdk: []

__java_open_jdk_package: openjdk-{{ java_open_jdk_version_major }}-jdk-headless
__java_open_jdk_home_dir: java-{{ java_open_jdk_version_major }}-openjdk-amd64
__java_open_jdk_home_dir_arm64: java-{{ java_open_jdk_version_major }}-openjdk-arm64
1 change: 1 addition & 0 deletions vars/openjdk/Ubuntu-18.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ __java_required_key_repositories_openjdk: []

__java_open_jdk_package: openjdk-{{ java_open_jdk_version_major }}-jdk-headless
__java_open_jdk_home_dir: java-{{ java_open_jdk_version_major }}-openjdk-amd64
__java_open_jdk_home_dir_arm64: java-{{ java_open_jdk_version_major }}-openjdk-arm64
1 change: 1 addition & 0 deletions vars/openjdk/Ubuntu-20.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ __java_required_key_repositories_openjdk: []

__java_open_jdk_package: openjdk-{{ java_open_jdk_version_major }}-jdk-headless
__java_open_jdk_home_dir: java-{{ java_open_jdk_version_major }}-openjdk-amd64
__java_open_jdk_home_dir_arm64: java-{{ java_open_jdk_version_major }}-openjdk-arm64

0 comments on commit 9b84773

Please sign in to comment.