44 lines
2.9 KiB
Docker
44 lines
2.9 KiB
Docker
FROM centos:centos8 as production
|
|
# https://gist.githubusercontent.com/mottyc/bcea44c569d6374d125abbb44cf97bb2/raw/067399f6ea4506eeaa08e04c0786fa3d86564697/keycloack-install
|
|
# https://markandruth.co.uk/2020/10/10/running-systemd-inside-a-centos-8-docker-container
|
|
# https://mtembo.com/technology/installing-keycloak/
|
|
#RUN dnf update -y
|
|
RUN dnf install -y java-1.8.0-openjdk-devel wget curl zip
|
|
RUN mkdir -p /opt/keycloak
|
|
RUN wget https://github.com/keycloak/keycloak/releases/download/12.0.4/keycloak-12.0.4.zip -P /opt/keycloak
|
|
WORKDIR /opt/keycloak
|
|
RUN unzip keycloak-12.0.4.zip -d /opt/keycloak
|
|
WORKDIR /opt/keycloak/keycloak-12.0.4
|
|
|
|
### Proxy environment. This should be done in keycloak.cli but don't know how
|
|
RUN sed -i 's/<http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true"\/>/<http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true" proxy-address-forwarding="true"\/>/g' standalone/configuration/standalone.xml
|
|
# postgres
|
|
# Download PostgreSQL database drivers
|
|
#RUN mkdir -p /opt/drivers/jdbc
|
|
#RUN wget https://jdbc.postgresql.org/download/postgresql-42.2.16.jar -P /opt/drivers/jdbc
|
|
#RUN /opt/keycloak/keycloak-12.0.4/bin/jboss-cli.sh -c --commands="module add --name=org.postgresql --dependencies=javax.api,javax.transaction.api --resources=/opt/drivers/jdbc/postgresql-42.2.16.jar"
|
|
#RUN /subsystem=datasources/jdbc-driver=postgresql:add(driver-name=postgresql,driver-module-name=org.postgresql,driver-class-name=org.postgresql.Driver)
|
|
#RUN /subsystem=datasources/data-source=KeycloakDS:remove
|
|
#RUN /subsystem=datasources/data-source=KeycloakDS:add(driver-name=postgresql,enabled=true,use-java-context=true,connection-url="jdbc:postgresql://host:port/database",jndi-name="java:/jboss/datasources/KeycloakDS",user-name=keycloak,password="PASSWORD",max-pool-size=20)
|
|
|
|
#RUN standalone.sh -b 0.0.0.0 -Djboss.http.port=9080 -Dkeycloak.import=/keycloak-work/freeipa-realm.json
|
|
RUN dnf -y install systemd; dnf clean all; \
|
|
(cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
|
|
rm -f /lib/systemd/system/multi-user.target.wants/*;\
|
|
rm -f /etc/systemd/system/*.wants/*;\
|
|
rm -f /lib/systemd/system/local-fs.target.wants/*; \
|
|
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
|
|
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
|
|
rm -f /lib/systemd/system/basic.target.wants/*;\
|
|
rm -f /lib/systemd/system/anaconda.target.wants/*;
|
|
|
|
RUN dnf -y install freeipa-client freeipa-admintools jna sssd-dbus
|
|
RUN wget https://download.copr.fedorainfracloud.org/results/giesen/libunix-dbus-java/epel-8-x86_64/01134406-libunix-dbus-java/libunix-dbus-java-0.8.0-2.el8.x86_64.rpm
|
|
RUN dnf install -y libunix-dbus-java-0.8.0-2.el8.x86_64.rpm
|
|
|
|
ADD docker-entrypoint.sh /
|
|
RUN chmod 700 /docker-entrypoint.sh
|
|
CMD ["/docker-entrypoint.sh"]
|
|
#CMD ["/opt/keycloak/keycloak-12.0.4/bin/standalone.sh","-b","0.0.0.0"]
|
|
|