checkpoint: cleaned disk and pruned Docker cache

This commit is contained in:
Josh 2025-07-10 15:13:18 +00:00
parent dfd02bbaab
commit 116fadc6bd
5 changed files with 32 additions and 8 deletions

View File

@ -18,3 +18,7 @@ REACT_APP_ENV=production
REACT_APP_OPENAI_API_KEY=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
OPENAI_API_KEY=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
GCP_CLOUD_SQL_PASSWORD=q2O}1PU-R:|l57S0
TWILIO_ACCOUNT_SID=ACd700c6fb9f691ccd9ccab73f2dd4173d
TWILIO_AUTH_TOKEN=fb8979ccb172032a249014c9c30eba80
TWILIO_MESSAGING_SERVICE_SID=MGMGaa07992a9231c841b1bfb879649026d6

View File

@ -1,13 +1,18 @@
ARG APPPORT=5002
FROM --platform=$TARGETPLATFORM node:20-slim
WORKDIR /app
COPY package*.json ./
RUN apt-get update -y && \
apt-get install -y --no-install-recommends python3 git && \
rm -rf /var/lib/apt/lists/*
COPY package*.json ./
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends python3 git \
&& rm -rf /var/lib/apt/lists/*
RUN npm ci --omit=dev --ignore-scripts
COPY . .
ENV PORT=5002
EXPOSE 5002
CMD ["node","backend/server3.js"]
CMD ["node", "backend/server3.js"]

View File

@ -1,5 +1,5 @@
// ─── server3.js ────────────────────────────────────────────────────────────
import './config/env.js';
import dotenv from 'dotenv';
import path from 'path';
import { fileURLToPath } from 'url';
@ -23,6 +23,10 @@ import Fuse from 'fuse.js';
import { createReminder } from './utils/smsService.js';
import { cacheSummary } from "./utils/ctxCache.js";
const rootPath = path.resolve(__dirname, '..'); // one level up
const env = (process.env.NODE_ENV || 'production'); // production in prod
const envPath = path.resolve(rootPath, `.env.${env}`); // => /app/.env.production
dotenv.config({ path: envPath });
const apiBase = process.env.APTIVA_API_BASE || "http://localhost:5002/api";
const app = express();
@ -52,7 +56,9 @@ app.use(cors({ origin: allowedOrigins, credentials: true }));
// 3) Authentication middleware
const authenticatePremiumUser = (req, res, next) => {
const token = req.headers.authorization?.split(' ')[1];
const token = (req.headers.authorization || '')
.replace(/^Bearer\s+/i, '') // drop “Bearer ”
.trim(); // strip CR/LF, spaces
if (!token) {
return res.status(401).json({ error: 'Premium authorization required' });
}

View File

@ -34,6 +34,9 @@ services:
env_file: [ ./env/prod.env ]
environment:
- NODE_ENV=production
- TWILIO_ACCOUNT_SID=ACd700c6fb9f691ccd9ccab73f2dd4173d
- TWILIO_AUTH_TOKEN=fb8979ccb172032a249014c9c30eba80
- TWILIO_MESSAGING_SERVICE_SID=MGMGaa07992a9231c841b1bfb879649026d6
volumes:
- /home/jcoakley/aptiva-dev1-app/public:/home/jcoakley/aptiva-dev1-app/public:ro
- /home/jcoakley/aptiva-dev1-app/user_profile.db:/home/jcoakley/aptiva-dev1-app/user_profile.db:ro

View File

@ -23,6 +23,12 @@ services:
image: us-central1-docker.pkg.dev/aptivaai-dev/aptiva-repo/server3:prod-20250710
restart: unless-stopped
expose: ["5002"]
environment:
NODE_ENV: production
JWT_SECRET: gW4QsOu4AJA4MooIUC9ld2i71VbBovzV1INsaU6ftxYPrxLIeMq6/OY61j0X2RV7
TWILIO_ACCOUNT_SID: ACd700c6fb9f691ccd9ccab73f2dd4173d
TWILIO_AUTH_TOKEN: fb8979ccb172032a249014c9c30eba80
TWILIO_MESSAGING_SERVICE_SID: MGMGaa07992a9231c841b1bfb879649026d6
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:5002/healthz || exit 1"]
interval: 30s