Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docker] Do not run container as root #5314

Merged
merged 5 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,8 @@ coreProjects.each { coreProject ->
def assembleTasks = collectTasksRecursively(coreProject, 'assemble')
def publishTasks = collectTasksRecursively(coreProject, 'publish')

// Add these tasks as dependencies of the release task
release.dependsOn assembleTasks
release.dependsOn publishTasks
// Explicitly declare release task for better gradle compatibility
def releaseTask = tasks.named('release').get()
janhoy marked this conversation as resolved.
Show resolved Hide resolved
releaseTask.dependsOn assembleTasks
releaseTask.dependsOn publishTasks
}
8 changes: 7 additions & 1 deletion release/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ ENV ENV_PIPELINE_FILEPATH=$PIPELINE_FILEPATH

# Update all packages
RUN dnf -y update
RUN dnf -y install bash bc
RUN dnf -y install bash bc shadow-utils
RUN dnf -y upgrade

# Create a dedicated user and group with specific UID/GID
RUN useradd -u 1000 -M -U -d / -s /sbin/nologin -c "Data Prepper" data_prepper

# Setup the Adoptium package repo and install Temurin Java
ADD adoptium.repo /etc/yum.repos.d/adoptium.repo
RUN dnf -y install temurin-17-jdk
Expand All @@ -25,5 +28,8 @@ RUN mv /usr/share/$ARCHIVE_FILE_UNPACKED /usr/share/data-prepper
COPY default-data-prepper-config.yaml $ENV_CONFIG_FILEPATH
COPY default-keystore.p12 /usr/share/data-prepper/keystore.p12

RUN chown -R 1000:1000 $DATA_PREPPER_PATH /var/log/data-prepper
USER data_prepper

WORKDIR $DATA_PREPPER_PATH
CMD ["bin/data-prepper"]
Loading