Merge pull request #71 from wahyd4/copilot/add-build-time-and-version-to-links-image

Add build time & version to Docker image footer
This commit is contained in:
2026-03-27 12:17:27 +11:00
committed by GitHub
5 changed files with 31 additions and 0 deletions
+7
View File
@@ -60,6 +60,10 @@ jobs:
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Set build timestamp
id: build_time
run: echo "value=$(date -u '+%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_OUTPUT
# Build and push main application image
- name: Build and push Docker image
uses: docker/build-push-action@v6
@@ -72,6 +76,9 @@ jobs:
ghcr.io/wahyd4/links:1.0.${{ github.run_number }}
labels: |-
${{ steps.meta.outputs.labels }}
build-args: |-
BUILD_TIME=${{ steps.build_time.outputs.value }}
BUILD_VERSION=1.0.${{ github.run_number }}
- name: Deploy to Kubernetes
uses: wahyd4/kubectl-helm-action@master
+6
View File
@@ -73,6 +73,10 @@ RUN rm -rf /tmp/.cache/uv ~/.npm ~/.cache \
# Production stage - use Python 3.12 slim
FROM python:3.12-slim AS production
# Build-time metadata
ARG BUILD_TIME=""
ARG BUILD_VERSION=""
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
@@ -81,6 +85,8 @@ ENV VIRTUAL_ENV=/app/.venv
ENV PATH="/app/.venv/bin:$PATH"
ENV DEBIAN_FRONTEND=noninteractive
ENV PLAYWRIGHT_BROWSERS_PATH=/app/.playwright
ENV BUILD_TIME=${BUILD_TIME}
ENV BUILD_VERSION=${BUILD_VERSION}
# Set work directory
WORKDIR /app
+8
View File
@@ -0,0 +1,8 @@
from django.conf import settings
def build_info(request):
return {
'BUILD_TIME': getattr(settings, 'BUILD_TIME', ''),
'BUILD_VERSION': getattr(settings, 'BUILD_VERSION', ''),
}
+5
View File
@@ -36,6 +36,7 @@ TEMPLATES = [
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'core.context_processors.build_info',
],
},
},
@@ -207,6 +208,10 @@ R2_CUSTOM_DOMAIN = os.environ.get('R2_CUSTOM_DOMAIN')
CRAWL4AI_API_URL = os.environ.get('CRAWL4AI_API_URL', 'https://crawl-api.junv.cc')
CRAWL4AI_ENABLED = os.environ.get('CRAWL4AI_ENABLED', 'True').lower() in ('true', '1', 'yes')
# Build metadata (injected at Docker image build time)
BUILD_TIME = os.environ.get('BUILD_TIME', '')
BUILD_VERSION = os.environ.get('BUILD_VERSION', '')
# For debugging
LOGGING = {
'version': 1,
+5
View File
@@ -252,5 +252,10 @@
});
</script>
{% block extra_js %}{% endblock %}
{% if BUILD_TIME %}
<footer class="text-center text-gray-400 text-xs py-3 mt-4 border-t border-gray-100">
Built at: {{ BUILD_TIME }} with ver: {{ BUILD_VERSION }}
</footer>
{% endif %}
</body>
</html>