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 1 commit
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
}
4 changes: 4 additions & 0 deletions release/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,9 @@ 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

# Do not run as root, but as user "nobody" (uid 65534)
RUN chown -R nobody:nobody $DATA_PREPPER_PATH /var/log/data-prepper
janhoy marked this conversation as resolved.
Show resolved Hide resolved
USER nobody

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