-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.dev.yml
More file actions
51 lines (50 loc) · 2.41 KB
/
docker-compose.dev.yml
File metadata and controls
51 lines (50 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Dev override that swaps the baked-in web.war for a live bind mount of
# transitclockWebapp/src/main/webapp. JSP / CSS / JS / image edits in the
# source tree appear in the running container with a browser refresh —
# no docker rebuild, no compose restart.
#
# Usage:
# # one-time: populate target/web/WEB-INF/{lib,classes} for the JSPs and
# # target/frontend-dist/ for the Vite-built Tailwind bundle.
# mvn -pl transitclockWebapp -am package -DskipTests
#
# # for fast Tailwind / frontend iteration, run Vite in watch mode in a
# # second terminal — output goes to target/frontend-dist/, which the
# # bind mount below picks up:
# cd transitclockWebapp && npm run dev
#
# # bring up tomcat with the override
# docker compose -f docker-compose.yml -f docker-compose.dev.yml up -d tomcat
#
# # edit transitclockWebapp/src/main/webapp/welcome/index.jsp, refresh page.
#
# Java class changes (anything under transitclockWebapp/src/main/java,
# transitclockApi, or core) still require a rebuild + restart:
# mvn -pl transitclockWebapp -am package -DskipTests \
# && docker compose -f docker-compose.yml -f docker-compose.dev.yml \
# restart tomcat
#
# To return to the production-style baked-WAR flow, drop the
# `-f docker-compose.dev.yml` flag.
services:
tomcat:
volumes:
- ./transitclockWebapp/src/main/webapp:/usr/local/tomcat/webapps/web
- ./transitclockWebapp/target/web/WEB-INF/lib:/usr/local/tomcat/webapps/web/WEB-INF/lib:ro
- ./transitclockWebapp/target/web/WEB-INF/classes:/usr/local/tomcat/webapps/web/WEB-INF/classes:ro
- ./transitclockWebapp/target/frontend-dist:/usr/local/tomcat/webapps/web/dist:ro
command:
- |
if [ -z "${TRANSITCLOCK_APIKEY:-}" ]; then
echo "ERROR: TRANSITCLOCK_APIKEY is unset. Mint a key with" >&2
echo " docker compose run --rm tools java -jar /workspace/transitclock/target/CreateAPIKey.jar ..." >&2
echo "(see docs/setup.md §0 step 7), then add" >&2
echo " TRANSITCLOCK_APIKEY=<the key>" >&2
echo "to .env and re-run 'docker compose up -d tomcat'." >&2
exit 64
fi
# Keep Tomcat from redeploying the baked WAR on top of our bind
# mount. The bind-mounted directory is the only source of truth
# while this override is active.
rm -f /usr/local/tomcat/webapps/web.war
exec catalina.sh run