Enhance Docker and Build Configuration

- Added support for build arguments in Dockerfile to specify UID, GID, version, build time, and commit hash.
- Updated docker-compose.yaml to utilize UID and GID for non-root user execution, improving file permission handling.
- Introduced entrypoint.sh script to manage user permissions and environment setup at container startup.
- Enhanced application logging to include version information during startup.
- Updated README with new instructions for running the application with specific user IDs and environment variables.
This commit is contained in:
StarFleetCPTN
2025-03-18 21:23:15 -07:00
parent 83be259754
commit 1981764f80
12 changed files with 509 additions and 42 deletions
+12
View File
@@ -3,6 +3,15 @@ services:
build:
context: .
dockerfile: Dockerfile
args:
# Set the UID/GID to match your host user for better file permissions
# Default is 1000:1000 if not specified
UID: ${UID:-1000}
GID: ${GID:-1000}
# Version information
VERSION: ${VERSION:-dev}
BUILD_TIME: ${BUILD_TIME:-unknown}
COMMIT: ${COMMIT:-unknown}
container_name: gomft
restart: unless-stopped
ports:
@@ -22,6 +31,9 @@ services:
# - LOG_LEVEL=info
networks:
- gomft-network
# For non-root installs, the container needs to run with the same UID
# as the host user to access mounted volumes properly
user: ${UID:-1000}:${GID:-1000}
networks:
gomft-network: