mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-16 19:33:11 +02:00
Remove gosu (#6036)
This commit is contained in:
@@ -513,7 +513,7 @@ jobs:
|
|||||||
echo "base_image=stirling-pdf-base:pr-test" >> $GITHUB_OUTPUT
|
echo "base_image=stirling-pdf-base:pr-test" >> $GITHUB_OUTPUT
|
||||||
echo "platforms=linux/amd64" >> $GITHUB_OUTPUT
|
echo "platforms=linux/amd64" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
echo "base_image=ghcr.io/${{ steps.repoowner.outputs.lowercase }}/stirling-pdf-base:latest" >> $GITHUB_OUTPUT
|
echo "base_image=stirlingtools/stirling-pdf-base:latest" >> $GITHUB_OUTPUT
|
||||||
echo "platforms=linux/amd64,linux/arm64/v8" >> $GITHUB_OUTPUT
|
echo "platforms=linux/amd64,linux/arm64/v8" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -386,7 +386,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
|||||||
# Core tools
|
# Core tools
|
||||||
ca-certificates tzdata tini bash fontconfig curl \
|
ca-certificates tzdata tini bash fontconfig curl \
|
||||||
ffmpeg poppler-utils fontforge \
|
ffmpeg poppler-utils fontforge \
|
||||||
gosu unpaper pngquant \
|
unpaper pngquant \
|
||||||
# Fonts: full coverage for standard + fat variants
|
# Fonts: full coverage for standard + fat variants
|
||||||
fonts-dejavu \
|
fonts-dejavu \
|
||||||
fonts-liberation2 \
|
fonts-liberation2 \
|
||||||
@@ -622,8 +622,7 @@ RUN set -eux; \
|
|||||||
-d /home/stirlingpdfuser -s /bin/bash stirlingpdfuser 2>/dev/null \
|
-d /home/stirlingpdfuser -s /bin/bash stirlingpdfuser 2>/dev/null \
|
||||||
|| useradd -m -g stirlingpdfgroup \
|
|| useradd -m -g stirlingpdfgroup \
|
||||||
-d /home/stirlingpdfuser -s /bin/bash stirlingpdfuser; \
|
-d /home/stirlingpdfuser -s /bin/bash stirlingpdfuser; \
|
||||||
fi; \
|
fi
|
||||||
ln -sf /usr/sbin/gosu /usr/local/bin/su-exec
|
|
||||||
|
|
||||||
# Application directories
|
# Application directories
|
||||||
RUN set -eux; \
|
RUN set -eux; \
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
# Stirling-PDF - Full version (embedded frontend)
|
# Stirling-PDF - Full version (embedded frontend)
|
||||||
# Uses pre-built base image for fast builds
|
# Uses pre-built base image for fast builds
|
||||||
|
|
||||||
ARG BASE_VERSION=1.0.0
|
ARG BASE_VERSION=1.0.1
|
||||||
ARG BASE_IMAGE=ghcr.io/stirling-tools/stirling-pdf-base:${BASE_VERSION}
|
ARG BASE_IMAGE=stirlingtools/stirling-pdf-base:${BASE_VERSION}
|
||||||
|
|
||||||
# Stage 1: Build the Java application and frontend
|
# Stage 1: Build the Java application and frontend
|
||||||
FROM gradle:9.3.1-jdk25 AS app-build
|
FROM gradle:9.3.1-jdk25 AS app-build
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
# Extra fonts for air-gapped environments
|
# Extra fonts for air-gapped environments
|
||||||
# Uses pre-built base image for fast builds
|
# Uses pre-built base image for fast builds
|
||||||
|
|
||||||
ARG BASE_VERSION=1.0.0
|
ARG BASE_VERSION=1.0.1
|
||||||
ARG BASE_IMAGE=ghcr.io/stirling-tools/stirling-pdf-base:${BASE_VERSION}
|
ARG BASE_IMAGE=stirlingtools/stirling-pdf-base:${BASE_VERSION}
|
||||||
|
|
||||||
# Stage 1: Build the Java application and frontend
|
# Stage 1: Build the Java application and frontend
|
||||||
FROM gradle:9.3.1-jdk25 AS app-build
|
FROM gradle:9.3.1-jdk25 AS app-build
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ RUN echo "@main https://dl-cdn.alpinelinux.org/alpine/edge/main" | tee -a /etc/a
|
|||||||
bash \
|
bash \
|
||||||
curl \
|
curl \
|
||||||
shadow \
|
shadow \
|
||||||
su-exec && \
|
util-linux && \
|
||||||
mkdir -p $HOME /configs /logs /customFiles /pipeline/watchedFolders /pipeline/finishedFolders /tmp/stirling-pdf /tmp/stirling-pdf/heap_dumps && \
|
mkdir -p $HOME /configs /logs /customFiles /pipeline/watchedFolders /pipeline/finishedFolders /tmp/stirling-pdf /tmp/stirling-pdf/heap_dumps && \
|
||||||
mkdir -p /usr/share/fonts/opentype/noto && \
|
mkdir -p /usr/share/fonts/opentype/noto && \
|
||||||
# User permissions
|
# User permissions
|
||||||
|
|||||||
@@ -176,13 +176,6 @@ UNOSERVER_PIDS=()
|
|||||||
UNOSERVER_PORTS=()
|
UNOSERVER_PORTS=()
|
||||||
UNOSERVER_UNO_PORTS=()
|
UNOSERVER_UNO_PORTS=()
|
||||||
|
|
||||||
SU_EXEC_BIN=""
|
|
||||||
if command_exists su-exec; then
|
|
||||||
SU_EXEC_BIN="su-exec"
|
|
||||||
elif command_exists gosu; then
|
|
||||||
SU_EXEC_BIN="gosu"
|
|
||||||
fi
|
|
||||||
|
|
||||||
CURRENT_USER="$(id -un)"
|
CURRENT_USER="$(id -un)"
|
||||||
CURRENT_UID="$(id -u)"
|
CURRENT_UID="$(id -u)"
|
||||||
SWITCH_USER_WARNING_EMITTED=false
|
SWITCH_USER_WARNING_EMITTED=false
|
||||||
@@ -197,8 +190,8 @@ warn_switch_user_once() {
|
|||||||
run_as_runtime_user() {
|
run_as_runtime_user() {
|
||||||
if [ "$CURRENT_USER" = "$RUNTIME_USER" ]; then
|
if [ "$CURRENT_USER" = "$RUNTIME_USER" ]; then
|
||||||
"$@"
|
"$@"
|
||||||
elif [ "$CURRENT_UID" -eq 0 ] && [ -n "$SU_EXEC_BIN" ]; then
|
elif [ "$CURRENT_UID" -eq 0 ] && command_exists setpriv; then
|
||||||
"$SU_EXEC_BIN" "$RUNTIME_USER" "$@"
|
setpriv --reuid="$RUNTIME_USER" --regid="$(id -gn "$RUNTIME_USER")" --init-groups -- "$@"
|
||||||
else
|
else
|
||||||
warn_switch_user_once
|
warn_switch_user_once
|
||||||
"$@"
|
"$@"
|
||||||
@@ -915,8 +908,8 @@ fi
|
|||||||
|
|
||||||
if [ "$CURRENT_USER" = "$RUNTIME_USER" ]; then
|
if [ "$CURRENT_USER" = "$RUNTIME_USER" ]; then
|
||||||
"${JAVA_CMD[@]}" &
|
"${JAVA_CMD[@]}" &
|
||||||
elif [ "$CURRENT_UID" -eq 0 ] && [ -n "$SU_EXEC_BIN" ]; then
|
elif [ "$CURRENT_UID" -eq 0 ] && command_exists setpriv; then
|
||||||
"$SU_EXEC_BIN" "$RUNTIME_USER" "${JAVA_CMD[@]}" &
|
setpriv --reuid="$RUNTIME_USER" --regid="$(id -gn "$RUNTIME_USER")" --init-groups -- "${JAVA_CMD[@]}" &
|
||||||
else
|
else
|
||||||
warn_switch_user_once
|
warn_switch_user_once
|
||||||
"${JAVA_CMD[@]}" &
|
"${JAVA_CMD[@]}" &
|
||||||
|
|||||||
+14
-2
@@ -88,6 +88,7 @@ capture_failure_logs() {
|
|||||||
capture_build_failure() {
|
capture_build_failure() {
|
||||||
local build_name=$1
|
local build_name=$1
|
||||||
local log_file="$REPORT_DIR/${build_name//[^a-zA-Z0-9_-]/_}.failure.log"
|
local log_file="$REPORT_DIR/${build_name//[^a-zA-Z0-9_-]/_}.failure.log"
|
||||||
|
local build_log="$REPORT_DIR/${build_name//[^a-zA-Z0-9_-]/_}.build.log"
|
||||||
local gradle_report_dirs=(
|
local gradle_report_dirs=(
|
||||||
"$PROJECT_ROOT/app/core/build/reports/tests"
|
"$PROJECT_ROOT/app/core/build/reports/tests"
|
||||||
"$PROJECT_ROOT/app/common/build/reports/tests"
|
"$PROJECT_ROOT/app/common/build/reports/tests"
|
||||||
@@ -99,6 +100,13 @@ capture_build_failure() {
|
|||||||
echo "Timestamp: $(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
echo "Timestamp: $(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
||||||
echo "---"
|
echo "---"
|
||||||
|
|
||||||
|
# Include Docker/command build output if captured
|
||||||
|
if [ -f "$build_log" ]; then
|
||||||
|
echo "--- Build output (last 100 lines) ---"
|
||||||
|
tail -100 "$build_log"
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
for report_dir in "${gradle_report_dirs[@]}"; do
|
for report_dir in "${gradle_report_dirs[@]}"; do
|
||||||
if [ -d "$report_dir" ]; then
|
if [ -d "$report_dir" ]; then
|
||||||
local txt_index="$report_dir/test/index.html"
|
local txt_index="$report_dir/test/index.html"
|
||||||
@@ -699,12 +707,14 @@ main() {
|
|||||||
else
|
else
|
||||||
DOCKER_CACHE_ARGS_ULTRA_LITE=""
|
DOCKER_CACHE_ARGS_ULTRA_LITE=""
|
||||||
fi
|
fi
|
||||||
|
local ultra_lite_build_log="$REPORT_DIR/Build-Ultra-Lite-Docker.build.log"
|
||||||
if ! docker buildx build --build-arg VERSION_TAG=alpha \
|
if ! docker buildx build --build-arg VERSION_TAG=alpha \
|
||||||
-t docker.stirlingpdf.com/stirlingtools/stirling-pdf:ultra-lite \
|
-t docker.stirlingpdf.com/stirlingtools/stirling-pdf:ultra-lite \
|
||||||
-f ./docker/embedded/Dockerfile.ultra-lite \
|
-f ./docker/embedded/Dockerfile.ultra-lite \
|
||||||
--load \
|
--load \
|
||||||
${DOCKER_CACHE_ARGS_ULTRA_LITE} .; then
|
${DOCKER_CACHE_ARGS_ULTRA_LITE} . 2>&1 | tee "$ultra_lite_build_log"; then
|
||||||
failed_tests+=("Build-Ultra-Lite-Docker")
|
failed_tests+=("Build-Ultra-Lite-Docker")
|
||||||
|
capture_build_failure "Build-Ultra-Lite-Docker"
|
||||||
gha_endgroup
|
gha_endgroup
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -783,13 +793,15 @@ main() {
|
|||||||
else
|
else
|
||||||
DOCKER_CACHE_ARGS_FAT=""
|
DOCKER_CACHE_ARGS_FAT=""
|
||||||
fi
|
fi
|
||||||
|
local fat_build_log="$REPORT_DIR/Build-Fat-Docker.build.log"
|
||||||
if ! docker buildx build --build-arg VERSION_TAG=alpha \
|
if ! docker buildx build --build-arg VERSION_TAG=alpha \
|
||||||
${BASE_IMAGE_ARG} \
|
${BASE_IMAGE_ARG} \
|
||||||
-t docker.stirlingpdf.com/stirlingtools/stirling-pdf:fat \
|
-t docker.stirlingpdf.com/stirlingtools/stirling-pdf:fat \
|
||||||
-f ./docker/embedded/Dockerfile.fat \
|
-f ./docker/embedded/Dockerfile.fat \
|
||||||
--load \
|
--load \
|
||||||
${DOCKER_CACHE_ARGS_FAT} .; then
|
${DOCKER_CACHE_ARGS_FAT} . 2>&1 | tee "$fat_build_log"; then
|
||||||
failed_tests+=("Build-Fat-Docker")
|
failed_tests+=("Build-Fat-Docker")
|
||||||
|
capture_build_failure "Build-Fat-Docker"
|
||||||
gha_endgroup
|
gha_endgroup
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user