mirror of
https://github.com/MrUnknownDE/unknownbin.git
synced 2026-04-19 06:13:44 +02:00
Add entrypoint to fix volume permissions at runtime
This commit is contained in:
15
entrypoint.sh
Normal file
15
entrypoint.sh
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This script ensures that the 'data' directory is owned by the 'appuser'
|
||||
# before the main application starts. This is crucial when using Docker volumes,
|
||||
# as the mounted directory from the host will be owned by root inside the container.
|
||||
|
||||
# Set the ownership of the data directory to the non-root user.
|
||||
# The '-R' flag makes it recursive.
|
||||
chown -R appuser:appgroup /usr/src/app/data
|
||||
|
||||
# Execute the main command (passed as arguments to this script)
|
||||
# as the non-root user 'appuser'.
|
||||
# 'su-exec' is a lightweight tool to switch users.
|
||||
# "$@" passes all arguments from the CMD line.
|
||||
exec su-exec appuser "$@"
|
||||
Reference in New Issue
Block a user