Ortus-Solutions / docker-commandbox

Official CommandBox Docker Image for ColdFusion/CFML/Java applications
62 stars 41 forks source link

Specify Alternate wwwroot #5

Closed jamiejackson closed 7 years ago

jamiejackson commented 7 years ago

In SCM, I have a bunch of directories at the same level as wwwroot; e.g.:

deployment_root
├──wwwroot
├──foo
├──bar
├──model
└──...

So I think I want to be able to do something like:

...
    environment:
      WWWROOT: "/app/wwwroot"
    volumes:
      - /Users/jjackson/projects/project_a/cfml/deployment_root:/app
...

Is there already a way to do this that I'm overlooking?

lmajano commented 7 years ago

Jamie You can mount multiple directories into the image but only one directory can be the web root. What is the purpose of the other folders

jamiejackson commented 7 years ago

I've got directories like, model, lib, test, etc. that are at the same level as wwwroot--directories used by the app, but outside of the web root. I would guess that I'm not the only one with applications that have a similar structure.

I forgot that I had to do a trick even with the official Lucee image:

Dockerfile

RUN \
  set -x \
  && sed \
    -i 's+<Context path="" docBase="/var/www/">+<Context path="" docBase="/var/www/wwwroot">+' \
    '/usr/local/tomcat/conf/server.xml'

docker-compose.yml

  lucee:
...
    volumes:
      - ./deployment_root:/var/www
...

... but I'm not Undertow-savvy, so I don't know how to do a similar trick with it.

jclausen commented 7 years ago

@jamiejackson : the convention APP_DIR for the CommandBox image is /app, therefore, the path you mount those files in to will either need to be /app/ or you'll need to pass an APP_DIR environment variable, telling it where to start up the server from. If your server uses a subdirectory, then you'll want to configure your server.json to tell CommandBox where that root is.

For example, if you mounted the above file system in to the /app directory, you would specify an environment variable for APP_DIR as /app/wwwroot.

Hope that helps!

jamiejackson commented 7 years ago

Yes, thanks, @jclausen!