Fix jwt-token

This commit is contained in:
2025-09-20 23:45:33 +02:00
parent 9641651bcc
commit 4579bae52e
2 changed files with 13 additions and 29 deletions

View File

@@ -1,14 +1,17 @@
# Backend Dockerfile for Drone Detection System
FROM node:18-alpine AS base
# Install system dependencies
# Install system dependencies and create user in one layer
RUN apk add --no-cache \
python3 \
make \
g++ \
curl \
dumb-init \
netcat-openbsd
netcat-openbsd \
su-exec && \
addgroup -g 1001 -S nodejs && \
adduser -S nodejs -u 1001
# Set working directory
WORKDIR /app
@@ -20,33 +23,15 @@ COPY package*.json ./
RUN npm install --only=production && \
npm cache clean --force
# Copy application code
# Copy application code
COPY --chown=nodejs:nodejs . .
# Copy and set permissions for entrypoint script
COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
# Install su-exec for user switching
RUN apk add --no-cache su-exec
# Create logs and uploads directories
# Create directories and copy files with proper ownership in one step
RUN mkdir -p logs uploads/logos
COPY --chown=nodejs:nodejs . .
COPY --chown=root:root docker-entrypoint.sh /usr/local/bin/
# Create non-root user
RUN addgroup -g 1001 -S nodejs && \
adduser -S nodejs -u 1001
# Set ownership of all app files including uploads
RUN chown -R nodejs:nodejs /app
# Ensure uploads directory has proper permissions
RUN chmod -R 755 /app/uploads
# Copy and set permissions for entrypoint script
COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
# Set all permissions in one layer
RUN chmod +x /usr/local/bin/docker-entrypoint.sh && \
chmod -R 755 /app/uploads && \
chown -R nodejs:nodejs /app
# Stay as root for the entrypoint (it will switch to nodejs user)
# USER nodejs (commented out - entrypoint will handle user switching)

View File

@@ -1,5 +1,4 @@
const { Sequelize } = re // Models are already initialized through the imports
console.log('📋 Models loaded and ready...');ire('sequelize');
const { Sequelize } = require('sequelize');
const bcrypt = require('bcryptjs');
// Import models from the main models index