<@U072YEFAT> any reason to need a full heavy docke...
# docker
p
@Jim Priest any reason to need a full heavy docker local setup/builds when commandbox can be running on a mac m1 in 2 minutes?
j
We have a very complicated Docker based development environment consisting of many containers, etc. Can't just spin up a vanilla image unfortunately.
👍🏻 1
p
Ahh that dockerfile only came off as 1 container plain jane CF2021
j
Yeah it's just a simple example for the issue I'm running into
p
All your other docker containers can run locally and your commandbox instance can easily interact with it as expected whether its DB containers etc
As for your error, that appears that your ENV app_dir is being ignored somewhere and just looking for /app which is the default
j
Yeah - some wires are getting crossed somewhere LOL I'm hoping @jclausen can take a peek and let me know what I'm doing wrong
It seems if I declare a different APP_DIR CommandBox still creates /app with some default files in it which is what the server is pointing to. Not my defined APP_DIR (/jim). Confused LOL.
p
is that directory
/jim
sitting in same folder as your Dockerfile
j
It's set in my docker compose file... and yes it's just one dir with my index.cfm, dockerfile and docker compose file
Copy code
volumes:
      - type: bind
        source: ${PWD}
        target: /jim
        consistency: consistent
So it's in the container, it's just that CommandBox isn't pointed there LOL
p
Shouldnt your target be just / since its the root that has all of your files (index.cfm etc?)
j
No - within the container it's either /app or /jim Looking at Adobe's Docker images they also use /app without giving you the opportunity to change it (sigh). I can maybe make /app work just going to have to rewrite a lot of scripts that point to our existing webroot dir...
p
I have always left it as /app any reason to need to change it within the container?
j
If you are using a multistage build, then the app directory is already defined. There are always two variables in play with a server start CFML file locations: •
APP_DIR
- The place from which the
run.sh
executes ( in the case of a finalized startup though, that finalized script executes and
APP_DIR
is what it was in the first stage •
BOX_SERVER_WEB_WEBROOT
- This is the location from which traffic is served - also in a finalized startup it is set when the script is created - it cannot be changed after that.
Why not just make an alias of
/jim
to
/app
and then the path checks resolve?
RUN ln -s /app /jim
j
Ah ha - I missed BOX_SERVER_WEB_WEBROOT!!! Thanks @jclausen for the clarification on the differences. Does that need to be added here maybe? https://github.com/Ortus-Solutions/docker-commandbox I can open a PR and add that.
j
No. It defaults to the current directory where the server is started, if not specified. Which, for most users of that container is
/app
👍 1
j
Think this may be my core issue. https://stackoverflow.com/questions/71247957/docker-compose-with-commandbox-cannot-change-web-root Symlink to /app seems to work fine with my test containers - will add that to my main build this afternoon and see.
Can confirm - this was the issue. Tweaked my dockerfile to pull vanilla CommandBox image, tweaked my dockerfile ENV settings and things spun up correctly with my custom webroot working! 🙂 Slower but for local dev it's no worse than before when we were installing CF...
Copy code
ENV BOX_SERVER_APP_CFENGINE adobe@2021.0.9+330148
ENV BOX_SERVER_PROFILE development
ENV BOX_SERVER_WEB_WEBROOT /virtual/www/htdocs/admin
j
If the production server is linux, it’s helpful that staging an dev environments are also linux. So much effort is expended on making mac and windows docker environments work like docker. Running a Linux VM on your OS is where I’m ending up, which in turn runs docker, and anything that it might need. This has turned out to smooth out a lot of issues and bugs. Easy to start up in a vm for developers as well. Docker seems easier to not use in the start until there’s updates to roll out. :)
j
Docker seems easier to not use in the start until there’s updates to roll out. 🙂
I would disagree wholeheartedly - especially having worked with all manner and of flavors of Virtualized development enviornments. When working with developers using multiple OS’ ( e.g. your UI team uses Mac, Your back-end team uses multiple flavors ) I have found docker makes it so much easier to provide a consistent development environment. It also makes it easy to stand up that environment for a new developer in a matter of minutes. When you run a Linux container locally You are running your app in Linux. The only disconnect is when you mount in file systems which are case-insensitive, which would run as case-sensitive in Linux. Some care and consideration in the development environment smooths those casing issue out.
💯 2