crpeck / cas-overlay-docker

Docker compose setup to build & run Apereo CAS in Docker
16 stars 8 forks source link

CAS Docker Overlay

Uses gradle to build CAS 6.x

Docker Compose setup using a multi-stage build:

To use

Notes

If you want to grab a copy of the cas.war file that is running in the container use the 'docker cp' command, for example:

wishbringer:~ $ docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                  PORTS                    NAMES
79e44dd14c7e        dockercasdev_cas    "/usr/bin/java -ja..."   21 seconds ago      Up 20 seconds           0.0.0.0:8443->8443/tcp   dockercasdev_cas_1
6f5bc662213b        nginx               "nginx -g 'daemon ..."   5 days ago          Exited (0) 5 days ago                            webserver
de061f8c8aef        alpine              "env"                    5 days ago          Exited (0) 5 days ago                            amazing_feynman
4e3975361ef2        alpine              "ifconfig"               5 days ago          Exited (0) 5 days ago                            keen_jang
wishbringer:~ $ docker cp 79e44dd14c7e:/root/cas.war .
wishbringer:~ $ ls -l cas.war
-rw-r--r--  1 crpeck  staff  91251638 Aug 15 14:40 cas.war

The end result is an image of about 173MB that has a full implementation of CAS.

REPOSITORY             TAG                 IMAGE ID            CREATED             SIZE
casoverlaydocker_cas   latest              954457811c53        18 seconds ago      173MB

Proxy authentication

In order to get the proxy authentication working, you need to make sure that the container has imported your SSL certificate (self signed or not).

Your certificate needs to be setup for a local host on your machine.

Step 1

Create a docker-compose.override.yml file:

version: '2'
services:
  cas:
    extra_hosts:
      - "casclient:172.22.0.1"

Change casclient and 172.22.0.1 based on your host settings.

On my side casclient is the hostname of CAS client application and 172.22.0.1 is the IP of the host running Docker.

Step 2

Copy the SSL certificate from your application into etc/cas/config/certificate.pem.

The format of the certificate must be in PEM.

Step 3

docker-compose up

or

docker-compose up --force-recreate --build

References

Documentation
Issue Tracker
Mailing Lists
Chatroom
Blog