cdsframework / ice

Immunization Calculation Engine (ICE) Service
https://cdsframework.atlassian.net/wiki/spaces/ICE/overview
Other
12 stars 9 forks source link

Docker container hangs when starting Tomcat #42

Open nscott opened 1 year ago

nscott commented 1 year ago

I attempted to follow the guides and it was pretty simple to get the container downloaded. Running it appeared to succeed, but nothing ever worked when curling it.

After a long investigation, it turns out that running java -version on the container always hangs.

I swapped the base image to tomcat:9-jre8-temurin-jammy (https://snyk.io/test/docker/tomcat%3A9-jre8-temurin-jammy) and was able to get the server started.

Separately, the base image being used appears to also have several critical vulnerabilities, and high vulnerabilities specifically targeting the JDK being used: https://snyk.io/test/docker/tomcat%3A9-jre8-alpine

There were a few other things I had to mess with to get it to start, but I haven't done any verification on the image besides asking it for it's version (which was successful).

Here's a link to my commit: https://github.com/nscott/cdsframework-ice/commit/30da197dc223c6cd73dfde4a0398f86484644c39

I'm not sure if there are further implications to moving off of Alpine for your Docker image, or if there's any desire for a full Docker compilation file, so I didn't open that as a PR. It also messes with some logging locations by default, and I would assume that's backwards-incompatible.

My environment is an M1 Mac running OSX Monterey 12.5, and I was previously testing this with 12.4.

darylbc commented 1 year ago

Thank you. We'll test with the newer base image and if all is well, will use the new image instead.

As for the curl tests, have you tred running the curl tests in the curl-rest-tests directory?

nscott commented 1 year ago

I only ran the version test; I haven't tried the others yet.

nscott commented 1 year ago

Just FYI I fixed the hanging issue. I think it has to do with ttys (or the lack there-of). Starting the server with bash works like a charm.

I pushed an update to the Dockerfile that feels more complete than before: https://github.com/cdsframework/ice/commit/84c1015ffbf59c9eebc8c5f55c185c0f591944b4

I ran the test suite against it and everything passed:

~/code/ice/curl-rest-tests on  full-dockerfile! ⌚ 12:54:40
$ ./run-all-tests.sh
Server TZ: Etc/UTC
get-ice-version-test.sh: passed
rest-test-json-evalue-gzip.sh: passed
rest-test-json-evalue.sh: passed
rest-test-json-evalueatspecifiedtime-gzip.sh: passed
rest-test-json-evalueatspecifiedtime.sh: passed
rest-test-xml-evalue-gzip.sh: passed
rest-test-xml-evalue.sh: passed
rest-test-xml-evalueatspecifiedtime-gzip.sh: passed
rest-test-xml-evalueatspecifiedtime.sh: passed

If we can put in an official Dockerfile that means multiplatform builds should also been pretty simple to turn on/off.