Fix jwt-token
This commit is contained in:
@@ -1,14 +1,17 @@
|
|||||||
# Backend Dockerfile for Drone Detection System
|
# Backend Dockerfile for Drone Detection System
|
||||||
FROM node:18-alpine AS base
|
FROM node:18-alpine AS base
|
||||||
|
|
||||||
# Install system dependencies
|
# Install system dependencies and create user in one layer
|
||||||
RUN apk add --no-cache \
|
RUN apk add --no-cache \
|
||||||
python3 \
|
python3 \
|
||||||
make \
|
make \
|
||||||
g++ \
|
g++ \
|
||||||
curl \
|
curl \
|
||||||
dumb-init \
|
dumb-init \
|
||||||
netcat-openbsd
|
netcat-openbsd \
|
||||||
|
su-exec && \
|
||||||
|
addgroup -g 1001 -S nodejs && \
|
||||||
|
adduser -S nodejs -u 1001
|
||||||
|
|
||||||
# Set working directory
|
# Set working directory
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
@@ -20,33 +23,15 @@ COPY package*.json ./
|
|||||||
RUN npm install --only=production && \
|
RUN npm install --only=production && \
|
||||||
npm cache clean --force
|
npm cache clean --force
|
||||||
|
|
||||||
# Copy application code
|
# Create directories and copy files with proper ownership in one step
|
||||||
# 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
|
|
||||||
RUN mkdir -p logs uploads/logos
|
RUN mkdir -p logs uploads/logos
|
||||||
|
COPY --chown=nodejs:nodejs . .
|
||||||
|
COPY --chown=root:root docker-entrypoint.sh /usr/local/bin/
|
||||||
|
|
||||||
# Create non-root user
|
# Set all permissions in one layer
|
||||||
RUN addgroup -g 1001 -S nodejs && \
|
RUN chmod +x /usr/local/bin/docker-entrypoint.sh && \
|
||||||
adduser -S nodejs -u 1001
|
chmod -R 755 /app/uploads && \
|
||||||
|
chown -R nodejs:nodejs /app
|
||||||
# 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
|
|
||||||
|
|
||||||
# Stay as root for the entrypoint (it will switch to nodejs user)
|
# Stay as root for the entrypoint (it will switch to nodejs user)
|
||||||
# USER nodejs (commented out - entrypoint will handle user switching)
|
# USER nodejs (commented out - entrypoint will handle user switching)
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
const { Sequelize } = re // Models are already initialized through the imports
|
const { Sequelize } = require('sequelize');
|
||||||
console.log('📋 Models loaded and ready...');ire('sequelize');
|
|
||||||
const bcrypt = require('bcryptjs');
|
const bcrypt = require('bcryptjs');
|
||||||
|
|
||||||
// Import models from the main models index
|
// Import models from the main models index
|
||||||
|
|||||||
Reference in New Issue
Block a user