Fixed docker build for testing purposes (#895)

* fixes the docker build, by using the theme

* create to constant as it's not passed keycloak 14
This commit is contained in:
Erik Jan de Wit 2021-07-27 11:24:36 +02:00 committed by GitHub
parent 9410b89ed4
commit 1a8cb6176e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 10 additions and 120 deletions

View file

@ -1,32 +1,11 @@
ARG DEFAULT_KEYCLOAK_ENDPOINT='http:\/\/localhost:8180'
FROM node:16 as builder
ARG DEFAULT_KEYCLOAK_ENDPOINT
ARG KEYCLOAK_ENDPOINT
FROM maven:3.6.0-jdk-11-slim as builder
WORKDIR /app
COPY . .
# replace Keycloak endpoints
RUN sed -i "s/${DEFAULT_KEYCLOAK_ENDPOINT}/${KEYCLOAK_ENDPOINT}/g" import.mjs &&\
sed -i "s/${DEFAULT_KEYCLOAK_ENDPOINT}/${KEYCLOAK_ENDPOINT}/g" src/context/auth/keycloak.ts &&\
sed -i "s/adminv2//g" snowpack.config.js
RUN mvn -f /app/keycloak-theme/pom.xml install
# install dependencies and build application
RUN npm ci
RUN npm run build
FROM quay.io/keycloak/keycloak:14.0.0
COPY --from=builder /app/keycloak-theme/target/classes /opt/jboss/keycloak/themes/keycloak.v2
FROM nginx:stable
ARG DEFAULT_KEYCLOAK_ENDPOINT
ARG KEYCLOAK_ENDPOINT
COPY --from=builder /app/build /usr/share/nginx/html
# setup reverse proxy for Keycloak endpoint
COPY nginx-default.conf /etc/nginx/conf.d/default.conf
# replace Keycloak endpoints
RUN sed -i "s/${DEFAULT_KEYCLOAK_ENDPOINT}/${KEYCLOAK_ENDPOINT}/g" /etc/nginx/conf.d/default.conf
EXPOSE 80
EXPOSE 8080

View file

@ -30,10 +30,10 @@ For development on this project you will need a running Keycloak server listenin
## Build and run through Docker
git checkout git@github.com:keycloak/keycloak-admin-ui.git
cd keycloak-admin-ui
docker-compose build
docker-compose up
docker build -t keycloak-v2 .
docker run --name keycloak-v2 -d -p 127.0.0.1:8080:8080 -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=admin keycloak-v2 -Dprofile.feature.newadmin=enabled
You can reach the new admin interface at http://localhost
You can reach the new admin interface at `http://localhost:8080`. Then go to `Realm Settings --> Themes` and set Admin Console Theme to `keycloak.v2`.
If your Keycloak instance is not on `localhost:8180`, create a file `.env` with the following:

View file

@ -12,7 +12,7 @@ mvn install
The jar created with `mvn install` needs to be deployed to a Maven repository. From there, it will become part of the Keycloak server build.
For development, you can also just copy the contents of `build/target/classes` to `<keycloak server>/themes/keycloak.v2`. Then restart the server.
For development, you can also just copy the contents of `./target/classes` to `<keycloak server>/themes/keycloak.v2`. Then restart the server.
# To Run

View file

@ -137,7 +137,7 @@
<![CDATA[
<script id="environment" type="application/json">
{
"loginRealm": "${loginRealm}",
"loginRealm": "master",
"authServerUrl": "${authServerUrl}",
"authUrl": "${authUrl}",
"consoleBaseUrl": "${consoleBaseUrl}",

View file

@ -1,39 +0,0 @@
server {
listen 80;
listen [::]:80;
server_name localhost;
gzip on;
gzip_disable "msie6";
gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_proxied any;
gzip_types
text/plain
text/css
text/js
text/xml
text/javascript
application/javascript
application/json
application/xml
application/rss+xml
image/svg+xml;
location /auth/ {
client_max_body_size 0;
proxy_pass http://localhost:8180/auth/;
}
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}

View file

@ -1,50 +0,0 @@
server {
listen 80;
listen [::]:80;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
location /auth/ {
proxy_pass http://localhost:8180/auth/;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}