diff --git a/Dockerfile b/Dockerfile index a6a4138e29..24b2215e3d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/README.md b/README.md index 8eb2fc96b6..bdff5ff7a1 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/keycloak-theme/README.md b/keycloak-theme/README.md index e1711eabfd..c202c4daa2 100644 --- a/keycloak-theme/README.md +++ b/keycloak-theme/README.md @@ -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 `/themes/keycloak.v2`. Then restart the server. +For development, you can also just copy the contents of `./target/classes` to `/themes/keycloak.v2`. Then restart the server. # To Run diff --git a/keycloak-theme/pom.xml b/keycloak-theme/pom.xml index 61cef85b22..347fd06cc1 100644 --- a/keycloak-theme/pom.xml +++ b/keycloak-theme/pom.xml @@ -137,7 +137,7 @@ { - "loginRealm": "${loginRealm}", + "loginRealm": "master", "authServerUrl": "${authServerUrl}", "authUrl": "${authUrl}", "consoleBaseUrl": "${consoleBaseUrl}", diff --git a/nginx-default.conf b/nginx-default.conf deleted file mode 100644 index 7800702116..0000000000 --- a/nginx-default.conf +++ /dev/null @@ -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; - } - -} \ No newline at end of file diff --git a/nginx.conf b/nginx.conf deleted file mode 100644 index 61b0594c41..0000000000 --- a/nginx.conf +++ /dev/null @@ -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; - #} -} \ No newline at end of file