Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.
TypeScript ai-agentai-resume-analyzerapplication-trackerapplication-tracking-systematscareerjob-applicationjob-automationjob-huntingjob-searchjob-seeker-toolsjob-trackerjob-trackingjobsearchjobseekersmcpollamaresumeresume-reviewself-hosted
Refactor docker entrypoint
Khuram Niazd821503be980
diff --git a/Dockerfile b/Dockerfileindex 912c8b2..858fa88 100644--- a/Dockerfile+++ b/Dockerfile@@ -29,13 +29,12 @@ FROM base AS runnerWORKDIR /app# Set environment variables-ENV NODE_ENV=productionENV NEXT_TELEMETRY_DISABLED=1-RUN apk add --no-cache openssl+RUN apk add --no-cache openssl su-execRUN addgroup --system --gid 1001 nodejs && \- adduser --system --uid 1001 nextjs+ adduser --system --uid 1001 -h /home/nextjs nextjs# Set the correct permission for prerender cacheRUN mkdir .next@@ -44,8 +43,6 @@ RUN chown nextjs:nodejs .next# Set up /data directory with the right permissionsRUN mkdir -p /data/files/resumes && chown -R nextjs:nodejs /data/files/resumes-# Automatically leverage output traces to reduce image size-COPY --from=builder /app/public ./publicCOPY --from=builder /app/prisma ./prismaCOPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./diff --git a/deploy.sh b/deploy.shindex b3c7027..24d5f10 100755--- a/deploy.sh+++ b/deploy.sh@@ -26,7 +26,7 @@ echo ""SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"cd "$SCRIPT_DIR"-echo -e "${GREEN}[1/6]${NC} Current directory: $SCRIPT_DIR"+echo -e "${GREEN}[1/5]${NC} Current directory: $SCRIPT_DIR"echo ""# Detect Docker Compose (standalone v2 or plugin)@@ -48,56 +48,21 @@ if [ ! -d ".git" ]; thenexit 1fi-# Ensure .env exists and AUTH_SECRET is set-echo -e "${GREEN}[2/6]${NC} Checking environment configuration..."--if [ ! -f ".env" ]; then- if [ -f ".env.example" ]; then- cp .env.example .env- echo -e " Created ${YELLOW}.env${NC} from .env.example"- else- echo -e " ${RED}Warning: No .env.example found. Creating empty .env${NC}"- touch .env- fi-fi--# Generate AUTH_SECRET if missing or empty-if ! grep -q '^AUTH_SECRET=.\+' .env 2>/dev/null; then- NEW_SECRET=$(openssl rand -base64 32)- if grep -q '^AUTH_SECRET=' .env 2>/dev/null; then- # AUTH_SECRET line exists but is empty — replace it (handle macOS vs Linux sed)- if sed --version >/dev/null 2>&1; then- sed -i "s|^AUTH_SECRET=.*|AUTH_SECRET=$NEW_SECRET|" .env- else- sed -i '' "s|^AUTH_SECRET=.*|AUTH_SECRET=$NEW_SECRET|" .env- fi- else- echo "AUTH_SECRET=$NEW_SECRET" >> .env- fi- echo -e " Generated ${YELLOW}AUTH_SECRET${NC} in .env"-else- echo -e " AUTH_SECRET already set in .env"-fi--echo ""-# Fetch latest changes-echo -e "${GREEN}[3/6]${NC} Fetching latest changes from GitHub..."+echo -e "${GREEN}[2/5]${NC} Fetching latest changes from GitHub..."git fetch origin# Checkout and pull the specified branch-echo -e "${GREEN}[4/6]${NC} Checking out branch: ${YELLOW}$BRANCH${NC}"+echo -e "${GREEN}[3/5]${NC} Checking out branch: ${YELLOW}$BRANCH${NC}"git checkout "$BRANCH"--echo -e "${GREEN}[4/6]${NC} Pulling latest changes..."git pull origin "$BRANCH"# Stop existing containers-echo -e "${GREEN}[5/6]${NC} Stopping existing containers..."+echo -e "${GREEN}[4/5]${NC} Stopping existing containers..."$COMPOSE_CMD down# Build and start containers-echo -e "${GREEN}[6/6]${NC} Building and starting containers..."+echo -e "${GREEN}[5/5]${NC} Building and starting containers..."$COMPOSE_CMD up -d --buildecho ""diff --git a/docker-compose.yml b/docker-compose.ymlindex 1611e91..82867a3 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -10,12 +10,13 @@ services:- NODE_ENV=production- DATABASE_URL=file:/data/dev.db- AUTH_SECRET=${AUTH_SECRET:-}- - NEXTAUTH_URL=${NEXTAUTH_URL}- - AUTH_TRUST_HOST=true- - OLLAMA_BASE_URL=${OLLAMA_BASE_URL}- - OPENAI_API_KEY=${OPENAI_API_KEY}- - DEEPSEEK_API_KEY=${DEEPSEEK_API_KEY}- - RAPIDAPI_KEY=${RAPIDAPI_KEY}+ - NEXTAUTH_URL=${NEXTAUTH_URL:-http://localhost:3000}+ - AUTH_TRUST_HOST=${AUTH_TRUST_HOST:-true}+ - TZ=${TZ:-America/Edmonton}+ - OLLAMA_BASE_URL=${OLLAMA_BASE_URL:-http://host.docker.internal:11434}+ - OPENAI_API_KEY=${OPENAI_API_KEY:-}+ - DEEPSEEK_API_KEY=${DEEPSEEK_API_KEY:-}+ - RAPIDAPI_KEY=${RAPIDAPI_KEY:-}volumes:- ./jobsyncdb/data:/datarestart: unless-stoppeddiff --git a/docker-entrypoint.sh b/docker-entrypoint.shindex 50902b5..79dea26 100755--- a/docker-entrypoint.sh+++ b/docker-entrypoint.sh@@ -7,6 +7,10 @@ if [ -z "$AUTH_SECRET" ]; thenecho "AUTH_SECRET was not set — generated a temporary secret for this container."fi+# Run migrations as root (before switching users)+npx -y [email protected] migrate deploy+# Fix /data permissions and run app as nextjs userchown -R nextjs:nodejs /data-exec su -m -s /bin/sh nextjs -c "npx -y [email protected] migrate deploy && node server.js"+export HOME=/home/nextjs+exec su-exec nextjs node server.js