Skip to content

Commit

Permalink
bump base image from 22.04 to 24.04 (#131)
Browse files Browse the repository at this point in the history
* upgrade base eclipse-temurin image to ubuntu 24.04 noble

* add BUILD_ARCHITECTURE build arg, default linux/amd64

* update ErrorFile path to /files for persistence; purge 90+ day old heap/error dirs
  • Loading branch information
labkey-willm authored Jan 10, 2025
1 parent e132067 commit b3044f1
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 15 deletions.
20 changes: 10 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# main eclipse-temurin jre, which is debian-based
ARG FROM_REPO_IMAGE=eclipse-temurin
ARG FROM_TAG=17-jre-jammy
ARG FROM_TAG=17-jre-noble

# uncomment for alpine-based eclipse-temurin jre
# ARG FROM_TAG=17-jre-alpine
Expand Down Expand Up @@ -151,22 +151,22 @@ RUN [ -n "${DEBUG}" ] && set -x; \
apt-get update; \
apt-get -yq --no-install-recommends install \
openssl \
gettext-base=0.21-4ubuntu4 \
unzip=6.0-26ubuntu3.1 \
gettext-base=0.21-14ubuntu2 \
unzip=6.0-28ubuntu4.1 \
; \
if [ -n "${DEBUG}" ]; then \
# next 2 lines are to get postgres15 to install on ubuntu 22.04
echo "deb http://apt.postgresql.org/pub/repos/apt $(grep VERSION_CODENAME /etc/os-release | cut -d "=" -f2)-pgdg main" > /etc/apt/sources.list.d/pgdg.list; \
wget -qO- https://www.postgresql.org/media/keys/ACCC4CF8.asc | tee /etc/apt/trusted.gpg.d/pgdg.asc > /dev/null 2>&1; \
apt-get update; \
apt-get -yq --no-install-recommends install \
iputils-ping=3:20211215-1 \
less=590-1ubuntu0.22.04.1 \
netcat=1.218-4ubuntu1 \
postgresql-client-15=15.5-1.pgdg22.04+1 \
sudo=1.9.9-1ubuntu2.4 \
tree=2.0.2-1 \
vim=2:8.2.3995-1ubuntu2.13 \
iputils-ping=3:20240117-1build1 \
less=590-2ubuntu2.1 \
netcat-traditional=1.10-48 \
postgresql-client-16=16.6-0ubuntu0.24.04.1 \
sudo=1.9.15p5-3ubuntu5 \
tree=2.1.1-2ubuntu3 \
vim=2:9.1.0016-1ubuntu7.5 \
; \
fi; \
apt-get -yq upgrade; \
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ endif

DEBUG ?=

FROM_TAG ?= 17-jre-jammy
FROM_TAG ?= 17-jre-noble

CACHE_FLAG ?= --no-cache

Expand All @@ -25,9 +25,12 @@ LABKEY_VERSION ?= 21.5-SNAPSHOT
LABKEY_DISTRIBUTION ?= community
LABKEY_EK ?= 123abc456

BUILD_ARCHITECTURE ?= linux/amd64

# repo/image:tags must be lowercase
BUILD_VERSION ?= $(shell echo '$(LABKEY_VERSION)' | tr A-Z a-z)
BUILD_DISTRIBUTION := $(shell echo '$(LABKEY_DISTRIBUTION)' | tr A-Z a-z)
BUILD_ARCHITECTURE ?= $(BUILD_ARCHITECTURE)

BUILD_REPO_URI ?= $(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_REGION).amazonaws.com
BUILD_REPO_NAME := labkey/$(BUILD_DISTRIBUTION)
Expand Down Expand Up @@ -57,6 +60,7 @@ build:
docker build \
--rm \
--compress \
--platform $(BUILD_ARCHITECTURE) \
$(CACHE_FLAG) \
-t $(BUILD_REPO_NAME):latest \
-t $(BUILD_LOCAL_TAG) \
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ services:
- JSON_OUTPUT=${JSON_OUTPUT-false}
- DD_COLLECT_APM=${DD_COLLECT_APM-false}
- SLEEP=${SLEEP:-0}
- PURGE_HEAP_AND_ERROR_LOGS_OLDER_THAN_DAYS=${PURGE_HEAP_AND_ERROR_LOGS_OLDER_THAN_DAYS:-90}

pg-lims_starter:
image: postgres:15
Expand Down
16 changes: 12 additions & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ CSP_ENFORCE="${CSP_ENFORCE:-}"
DD_COLLECT_APM="${DD_COLLECT_APM:-false}"
JAVA_RMI_SERVER_HOSTNAME="${JAVA_RMI_SERVER_HOSTNAME:-}"

# set age past which old heap and error log directories are removed
PURGE_HEAP_AND_ERROR_LOGS_OLDER_THAN_DAYS="${PURGE_HEAP_AND_ERROR_LOGS_OLDER_THAN_DAYS:-90}"

SLEEP="${SLEEP:=0}"

main() {
Expand Down Expand Up @@ -263,22 +266,27 @@ main() {
unset LABKEY_CREATE_INITIAL_USER LABKEY_CREATE_INITIAL_USER_APIKEY LABKEY_INITIAL_USER_APIKEY LABKEY_INITIAL_USER_EMAIL LABKEY_INITIAL_USER_GROUP LABKEY_INITIAL_USER_ROLE
unset LABKEY_EK SLEEP CONTAINER_PRIVATE_IP

HEAP_DUMP_PATH="$LABKEY_HOME/files/heap_dumps_$(date +%Y%m%d_%H%M%S)"
mkdir -pv $HEAP_DUMP_PATH
echo "Creating new heap/error log directory..."
HEAP_AND_ERROR_PATH="$LABKEY_HOME/files/heap_dumps_and_errors_$(date +%Y%m%d_%H%M%S)"
mkdir -pv $HEAP_AND_ERROR_PATH

# purge old heap/error directories
echo "Purging heap/error log directories older than $PURGE_HEAP_AND_ERROR_LOGS_OLDER_THAN_DAYS days..."
find "$LABKEY_HOME/files/" -mindepth 1 -maxdepth 1 -type d -ctime +${PURGE_HEAP_AND_ERROR_LOGS_OLDER_THAN_DAYS} -name "heap*" | xargs rm -rf

# shellcheck disable=SC2086
exec java \
\
-Duser.timezone="${JAVA_TIMEZONE}" \
\
-XX:+HeapDumpOnOutOfMemoryError \
-XX:HeapDumpPath="${HEAP_DUMP_PATH}" \
-XX:HeapDumpPath="${HEAP_AND_ERROR_PATH}" \
\
-XX:MaxRAMPercentage="${MAX_JVM_RAM_PERCENT}" \
\
-XX:+UseContainerSupport \
\
-XX:ErrorFile="${LABKEY_HOME}/logs/error_%p.log" \
-XX:ErrorFile="${HEAP_AND_ERROR_PATH}/error_%p.log" \
\
-Djava.net.preferIPv4Stack=true \
\
Expand Down

0 comments on commit b3044f1

Please sign in to comment.