feat(keycloak): allow importing providers and providing build flags to kc.sh build
This commit is contained in:
parent
8c280b08ec
commit
bd771d7edd
3 changed files with 25 additions and 2 deletions
|
@ -8,6 +8,9 @@ keycloak_container_image_name: "keycloak:{{ keycloak_version }}-custom"
|
||||||
|
|
||||||
keycloak_container_database_vendor: postgres
|
keycloak_container_database_vendor: postgres
|
||||||
keycloak_container_build_directory: /opt/keycloak/build
|
keycloak_container_build_directory: /opt/keycloak/build
|
||||||
|
keycloak_container_build_jar_directory: providers
|
||||||
|
keycloak_container_build_flags: {}
|
||||||
|
keycloak_provider_jars_directory: "{{ keycloak_container_build_directory }}/{{ keycloak_container_build_jar_directory }}"
|
||||||
|
|
||||||
keycloak_database_hostname: localhost
|
keycloak_database_hostname: localhost
|
||||||
keycloak_database_port: 5432
|
keycloak_database_port: 5432
|
||||||
|
|
|
@ -7,11 +7,18 @@
|
||||||
recurse: yes
|
recurse: yes
|
||||||
mode: 0700
|
mode: 0700
|
||||||
|
|
||||||
|
- name: Ensure provider jars directory exists
|
||||||
|
file:
|
||||||
|
name: "{{ keycloak_provider_jars_directory }}"
|
||||||
|
state: directory
|
||||||
|
mode: 0775
|
||||||
|
|
||||||
- name: Ensure Dockerfile is templated
|
- name: Ensure Dockerfile is templated
|
||||||
template:
|
template:
|
||||||
src: Dockerfile.j2
|
src: Dockerfile.j2
|
||||||
dest: "{{ keycloak_container_build_directory }}/Dockerfile"
|
dest: "{{ keycloak_container_build_directory }}/Dockerfile"
|
||||||
mode: 0640
|
mode: 0700
|
||||||
|
register: keycloak_buildfile_info
|
||||||
|
|
||||||
- name: Ensure Keycloak container image is present
|
- name: Ensure Keycloak container image is present
|
||||||
docker_image:
|
docker_image:
|
||||||
|
@ -46,3 +53,5 @@
|
||||||
--db-password {{ keycloak_database_password }}
|
--db-password {{ keycloak_database_password }}
|
||||||
--db-url jdbc:postgresql://{{ keycloak_database_hostname }}:{{ keycloak_database_port }}/{{ keycloak_database_database }}
|
--db-url jdbc:postgresql://{{ keycloak_database_hostname }}:{{ keycloak_database_port }}/{{ keycloak_database_database }}
|
||||||
--optimized
|
--optimized
|
||||||
|
tags:
|
||||||
|
- keycloak-container
|
||||||
|
|
|
@ -9,7 +9,18 @@ ARG DB_VENDOR
|
||||||
ENV KC_DB=$DB_VENDOR
|
ENV KC_DB=$DB_VENDOR
|
||||||
|
|
||||||
WORKDIR {{ keycloak_container_working_directory }}
|
WORKDIR {{ keycloak_container_working_directory }}
|
||||||
RUN {{ keycloak_container_working_directory }}/bin/kc.sh build
|
|
||||||
|
ADD ./providers/* providers/
|
||||||
|
# Workaround to set correct mode on jar files
|
||||||
|
USER root
|
||||||
|
RUN chmod -R 0770 providers/*
|
||||||
|
USER keycloak
|
||||||
|
|
||||||
|
RUN {{ keycloak_container_working_directory }}/bin/kc.sh --verbose \
|
||||||
|
{% for argument in keycloak_container_build_flags | dict2items(key_name='flag', value_name='value') %}
|
||||||
|
--{{- argument['flag'] -}}{{- argument['value'] | default(false, true) | ternary('=' + argument['value'], '') }} \
|
||||||
|
{% endfor%}
|
||||||
|
build
|
||||||
|
|
||||||
|
|
||||||
FROM {{ keycloak_container_upstream_image_name }}:{{ keycloak_version }}
|
FROM {{ keycloak_container_upstream_image_name }}:{{ keycloak_version }}
|
||||||
|
|
Reference in a new issue