mirror of
https://github.com/StarFleetCPTN/GoMFT.git
synced 2026-10-29 16:30:26 +01:00
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:
1 parent
83be259754
commit
1981764f80
12 files changed
+509
-42
No files matched your search
@@ -513,11 +513,96 @@ templ AdminTools(ctx context.Context, data AdminToolsData) {
|
||||
{ fmt.Sprint(data.TotalJobs) }
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
<div class="sm:col-span-1">
|
||||
<dt class="text-sm font-medium text-secondary-500 dark:text-secondary-400">Application Version</dt>
|
||||
<dd class="mt-1 text-sm text-secondary-900 dark:text-secondary-100">
|
||||
<div class="flex items-center">
|
||||
<span>{ AppVersion }</span>
|
||||
if AppVersion == "dev" {
|
||||
<a href="https://github.com/starfleetcptn/gomft/releases"
|
||||
class="ml-2 text-primary-600 dark:text-primary-400 hover:text-primary-700 dark:hover:text-primary-300"
|
||||
target="_blank" rel="noopener">
|
||||
<i class="fas fa-external-link-alt text-xs"></i>
|
||||
</a>
|
||||
} else if AppVersion == "1.0.0" {
|
||||
<a href="https://github.com/starfleetcptn/gomft/releases/tag/v1.0.0"
|
||||
class="ml-2 text-primary-600 dark:text-primary-400 hover:text-primary-700 dark:hover:text-primary-300"
|
||||
target="_blank" rel="noopener">
|
||||
<i class="fas fa-external-link-alt text-xs"></i>
|
||||
</a>
|
||||
} else if AppVersion == "1.1.0" {
|
||||
<a href="https://github.com/starfleetcptn/gomft/releases/tag/v1.1.0"
|
||||
class="ml-2 text-primary-600 dark:text-primary-400 hover:text-primary-700 dark:hover:text-primary-300"
|
||||
target="_blank" rel="noopener">
|
||||
<i class="fas fa-external-link-alt text-xs"></i>
|
||||
</a>
|
||||
} else {
|
||||
<a href="https://github.com/starfleetcptn/gomft/releases"
|
||||
class="ml-2 text-primary-600 dark:text-primary-400 hover:text-primary-700 dark:hover:text-primary-300"
|
||||
target="_blank" rel="noopener">
|
||||
<i class="fas fa-external-link-alt text-xs"></i>
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Build Information -->
|
||||
<div class="mt-6">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="text-lg font-medium text-secondary-900 dark:text-secondary-100">
|
||||
<i class="fas fa-code-branch mr-2 text-primary-500"></i>
|
||||
Build Information
|
||||
</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="relative overflow-hidden bg-secondary-50 dark:bg-secondary-900 rounded-lg">
|
||||
<div class="px-4 py-5 sm:p-6">
|
||||
<dl class="grid grid-cols-1 gap-x-4 gap-y-6 sm:grid-cols-3">
|
||||
<div class="sm:col-span-1">
|
||||
<dt class="text-sm font-medium text-secondary-500 dark:text-secondary-400">Version</dt>
|
||||
<dd class="mt-1 text-sm text-secondary-900 dark:text-secondary-100 font-mono">
|
||||
{ AppVersion }
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
<div class="sm:col-span-1">
|
||||
<dt class="text-sm font-medium text-secondary-500 dark:text-secondary-400">Build Time</dt>
|
||||
<dd class="mt-1 text-sm text-secondary-900 dark:text-secondary-100 font-mono">
|
||||
{ getBuildTime() }
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
<div class="sm:col-span-1">
|
||||
<dt class="text-sm font-medium text-secondary-500 dark:text-secondary-400">Commit</dt>
|
||||
<dd class="mt-1 text-sm text-secondary-900 dark:text-secondary-100 font-mono">
|
||||
{ getCommit() }
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
|
||||
<div class="mt-6 flex justify-end">
|
||||
<a
|
||||
href="https://github.com/starfleetcptn/gomft"
|
||||
class="inline-flex items-center px-4 py-2 text-sm text-primary-600 dark:text-primary-400 hover:text-primary-700 dark:hover:text-primary-300 transition-colors"
|
||||
target="_blank" rel="noopener"
|
||||
>
|
||||
<i class="fab fa-github mr-2"></i>
|
||||
View on GitHub
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Log Viewer -->
|
||||
<div id="logs-container" class="mt-8">
|
||||
@AdminLogViewer(data)
|
||||
@@ -897,3 +982,21 @@ templ AdminLogContent(data AdminToolsData) {
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
// getBuildTime returns the build time of the application
|
||||
// This can be set using ldflags during build
|
||||
// Example: go build -ldflags "-X github.com/starfleetcptn/gomft/components.BuildTime=2023-01-01T00:00:00Z"
|
||||
var BuildTime = "unknown"
|
||||
|
||||
func getBuildTime() string {
|
||||
return BuildTime
|
||||
}
|
||||
|
||||
// getCommit returns the commit hash of the application
|
||||
// This can be set using ldflags during build
|
||||
// Example: go build -ldflags "-X github.com/starfleetcptn/gomft/components.Commit=abcdef123456"
|
||||
var Commit = "unknown"
|
||||
|
||||
func getCommit() string {
|
||||
return Commit
|
||||
}
|
||||
+25
-1
@@ -3,8 +3,20 @@ package components
|
||||
import (
|
||||
"context"
|
||||
"github.com/gin-gonic/gin"
|
||||
"time"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// AppVersion will be set at build time using ldflags
|
||||
// Example build command:
|
||||
// go build -ldflags "-X github.com/starfleetcptn/gomft/components.AppVersion=1.2.3"
|
||||
var AppVersion = "dev"
|
||||
|
||||
// GetReleaseURL returns the URL to the specific GitHub release
|
||||
func GetReleaseURL() templ.SafeURL {
|
||||
return templ.SafeURL(fmt.Sprintf("https://github.com/starfleetcptn/gomft/releases/tag/v%s", AppVersion))
|
||||
}
|
||||
|
||||
// CreateTemplateContext creates a new context with user information from Gin's context
|
||||
func CreateTemplateContext(c *gin.Context) context.Context {
|
||||
ctx := context.Background()
|
||||
@@ -437,6 +449,18 @@ templ LayoutWithContext(title string, ctx context.Context) {
|
||||
<p class="text-center text-sm text-secondary-500 dark:text-secondary-400">
|
||||
GoMFT © { getCurrentYear() } | Secure File Transfer Solution
|
||||
</p>
|
||||
<div class="flex justify-center items-center space-x-4 mt-1">
|
||||
<p class="text-xs text-secondary-400 dark:text-secondary-500">
|
||||
<a href="https://github.com/starfleetcptn/gomft" class="hover:text-primary-600 dark:hover:text-primary-400 transition-colors duration-200" target="_blank" rel="noopener">
|
||||
<i class="fab fa-github mr-1"></i>GitHub
|
||||
</a>
|
||||
</p>
|
||||
<p class="text-xs text-secondary-400 dark:text-secondary-500">
|
||||
<a href={ GetReleaseURL() } class="hover:text-primary-600 dark:hover:text-primary-400 transition-colors duration-200" target="_blank" rel="noopener">
|
||||
<i class="fas fa-tag mr-1"></i>Version { AppVersion }
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -544,5 +568,5 @@ func getUserEmail(ctx context.Context) string {
|
||||
|
||||
// Helper function to get current year
|
||||
func getCurrentYear() string {
|
||||
return "2025"
|
||||
return time.Now().Format("2006")
|
||||
}
|
||||
Reference in new issue
Block a user