Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65cc0c7b6d | ||
|
|
f137ded5aa | ||
|
|
946f1787c7 |
@@ -1,10 +1,11 @@
|
|||||||
FROM python:3.12-slim
|
FROM python:3.12-slim
|
||||||
|
|
||||||
# Install system dependencies required for python-ldap (needed by backend)
|
# Install system dependencies
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
build-essential \
|
build-essential \
|
||||||
libldap2-dev \
|
libldap2-dev \
|
||||||
libsasl2-dev \
|
libsasl2-dev \
|
||||||
|
gosu \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
@@ -26,14 +27,13 @@ COPY scripts ./scripts
|
|||||||
ENV DATA_DIR="/app/data"
|
ENV DATA_DIR="/app/data"
|
||||||
ENV LOGS_DIR="/app/logs"
|
ENV LOGS_DIR="/app/logs"
|
||||||
|
|
||||||
# Ensure the appuser can write to data and logs if we pre-create them,
|
# Pre-create directories and ensure they are writable
|
||||||
# although Docker volumes will handle ownership context.
|
|
||||||
RUN mkdir -p /app/data /app/logs && chown -R appuser:appuser /app
|
RUN mkdir -p /app/data /app/logs && chown -R appuser:appuser /app
|
||||||
|
|
||||||
# Make initialization scripts executable
|
# Make initialization scripts executable
|
||||||
RUN chmod +x /app/scripts/init_data.sh /app/backend/entrypoint.sh
|
RUN chmod +x /app/scripts/init_data.sh /app/backend/entrypoint.sh
|
||||||
|
|
||||||
USER appuser
|
EXPOSE 8000
|
||||||
|
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,10 @@ export LOGS_DIR="${LOGS_DIR:-/app/logs}"
|
|||||||
echo "🐳 [Docker] Running data initialization..."
|
echo "🐳 [Docker] Running data initialization..."
|
||||||
bash /app/scripts/init_data.sh
|
bash /app/scripts/init_data.sh
|
||||||
|
|
||||||
# Hand off to the application server
|
# Fix permissions for mounted volumes (which might be root-owned by the host)
|
||||||
echo "🐳 [Docker] Starting uvicorn..."
|
echo "🐳 [Docker] Fixing volume permissions..."
|
||||||
exec python -m uvicorn backend.main:app --host 0.0.0.0 --port 8000
|
chown -R appuser:appuser "${DATA_DIR}" "${LOGS_DIR}"
|
||||||
|
|
||||||
|
# Hand off to the application server as non-root user
|
||||||
|
echo "🐳 [Docker] Starting uvicorn as appuser..."
|
||||||
|
exec gosu appuser python -m uvicorn backend.main:app --host 0.0.0.0 --port 8000
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ RUN npm run build
|
|||||||
|
|
||||||
# Step 3: Production image
|
# Step 3: Production image
|
||||||
FROM base AS runner
|
FROM base AS runner
|
||||||
|
RUN apk add --no-cache su-exec
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
ENV NODE_ENV production
|
ENV NODE_ENV production
|
||||||
@@ -38,11 +39,13 @@ RUN chown nextjs:nodejs .next
|
|||||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||||
|
|
||||||
USER nextjs
|
# Copy entrypoint script
|
||||||
|
COPY entrypoint.sh /app/entrypoint.sh
|
||||||
|
RUN chmod +x /app/entrypoint.sh
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
ENV PORT 3000
|
ENV PORT 3000
|
||||||
ENV HOSTNAME "0.0.0.0"
|
ENV HOSTNAME "0.0.0.0"
|
||||||
|
|
||||||
# Note: The server.js is created by next build from the standalone output
|
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||||
CMD ["node", "server.js"]
|
|
||||||
|
|||||||
@@ -1,5 +1 @@
|
|||||||
{
|
{"version": "1.9.0", "last_build": "2026-04-13-2040", "codename": "Stability", "commit": "f137ded5"}
|
||||||
"version": "1.8.7",
|
|
||||||
"last_build": "2026-04-13-1954",
|
|
||||||
"codename": "TypeFix"
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -890,7 +890,7 @@ export default function Home() {
|
|||||||
<Printer size={14} /> Print Label
|
<Printer size={14} /> Print Label
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
onClick={() => { setQuery(box.toLowerCase()); setShowBoxManager(false); }}
|
onClick={() => { setSearchQuery(box.toLowerCase()); setShowBoxManager(false); }}
|
||||||
className="px-4 py-3 bg-slate-900 border border-slate-800 text-slate-400 text-xs font-bold rounded-xl hover:bg-slate-800"
|
className="px-4 py-3 bg-slate-900 border border-slate-800 text-slate-400 text-xs font-bold rounded-xl hover:bg-slate-800"
|
||||||
>
|
>
|
||||||
View
|
View
|
||||||
@@ -1004,7 +1004,7 @@ export default function Home() {
|
|||||||
<footer className="mt-20 mb-8 flex flex-col items-center gap-2 opacity-30">
|
<footer className="mt-20 mb-8 flex flex-col items-center gap-2 opacity-30">
|
||||||
<p className="text-xs font-bold">Powered by TFM Group Software</p>
|
<p className="text-xs font-bold">Powered by TFM Group Software</p>
|
||||||
<div className="h-px w-12 bg-slate-800" />
|
<div className="h-px w-12 bg-slate-800" />
|
||||||
<p className="text-[9px] font-mono">v{versionData.version} • {versionData.last_build} • BUILD: dev-{versionData.commit}</p>
|
<p className="text-[9px] font-mono">v{versionData.version} • {versionData.last_build} • BUILD: dev-{(versionData as any).commit || 'N/A'}</p>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
</PageShell>
|
</PageShell>
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ export default function Scanner({ onScanSuccess, onOCRMatch, paused }: ScannerPr
|
|||||||
Html5QrcodeSupportedFormats.CODE_39,
|
Html5QrcodeSupportedFormats.CODE_39,
|
||||||
Html5QrcodeSupportedFormats.EAN_13,
|
Html5QrcodeSupportedFormats.EAN_13,
|
||||||
Html5QrcodeSupportedFormats.UPC_A,
|
Html5QrcodeSupportedFormats.UPC_A,
|
||||||
Html5QrcodeSupportedFormats.DATAMATRIX
|
Html5QrcodeSupportedFormats.DATA_MATRIX
|
||||||
],
|
],
|
||||||
videoConstraints: {
|
videoConstraints: {
|
||||||
facingMode: "environment"
|
facingMode: "environment"
|
||||||
|
|||||||
19
frontend/entrypoint.sh
Normal file
19
frontend/entrypoint.sh
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# =============================================================================
|
||||||
|
# frontend/entrypoint.sh
|
||||||
|
# =============================================================================
|
||||||
|
# Docker container entrypoint for TFM aInventory frontend.
|
||||||
|
# Fixes permissions for the logs volume and starts the Node.js server.
|
||||||
|
# =============================================================================
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Fix permissions for the logs directory (useful if mounted as a volume)
|
||||||
|
if [ -d "/app/logs" ]; then
|
||||||
|
echo "🐳 [Docker] Fixing /app/logs permissions..."
|
||||||
|
chown -R nextjs:nodejs /app/logs
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Hand off to the application server as the nextjs user
|
||||||
|
echo "🐳 [Docker] Starting Next.js standalone server as nextjs user..."
|
||||||
|
exec su-exec nextjs node server.js
|
||||||
1
frontend/public/sw.js
Normal file
1
frontend/public/sw.js
Normal file
File diff suppressed because one or more lines are too long
1
frontend/public/workbox-4754cb34.js
Normal file
1
frontend/public/workbox-4754cb34.js
Normal file
File diff suppressed because one or more lines are too long
@@ -53,8 +53,15 @@ def main():
|
|||||||
data['version'] = new_version
|
data['version'] = new_version
|
||||||
data['last_build'] = datetime.now().strftime("%Y-%m-%d-%H%M")
|
data['last_build'] = datetime.now().strftime("%Y-%m-%d-%H%M")
|
||||||
|
|
||||||
|
# Get current git commit (short)
|
||||||
|
try:
|
||||||
|
commit_hash = run_command([git, 'rev-parse', '--short', 'HEAD'])
|
||||||
|
data['commit'] = commit_hash
|
||||||
|
except Exception:
|
||||||
|
data['commit'] = 'unknown'
|
||||||
|
|
||||||
# Optional: Rotate changelog if needed, but for now just update version
|
# Optional: Rotate changelog if needed, but for now just update version
|
||||||
print(f"Incrementing version: {old_version} -> {new_version}")
|
print(f"Incrementing version: {old_version} -> {new_version} (commit: {data['commit']})")
|
||||||
|
|
||||||
with open(VERSION_FILE, 'w') as f:
|
with open(VERSION_FILE, 'w') as f:
|
||||||
json.dump(data, f, indent=2)
|
json.dump(data, f, indent=2)
|
||||||
|
|||||||
Reference in New Issue
Block a user