diff --git a/Dockerfile b/Dockerfile index 0a17daa..637b21d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,12 +9,11 @@ RUN npm install # Copy app source COPY . . -# Create necessary directories with correct permissions +# Create directories and set permissions RUN mkdir -p /app/data /app/public/uploads && \ - chown -R node:node /app/data /app/public/uploads - -# Switch to non-root user -USER node + chown -R node:node /app && \ + chmod -R 755 /app && \ + chmod -R 777 /app/data /app/public/uploads # Expose port EXPOSE 2222 diff --git a/docker-compose.yml b/docker-compose.yml index 70bc2d9..02ec941 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,23 +13,13 @@ services: - NODE_ENV=production - JWT_SECRET=changeme_in_production - PORT=2222 + - UID=1000 + - GID=1000 + user: "1000:1000" # Utiliser l'utilisateur node restart: unless-stopped networks: - nginx_default networks: nginx_default: - external: true - -# Nginx configuration example: -# location /notes/ { -# proxy_pass http://notes-todo-app:2222/; -# proxy_http_version 1.1; -# proxy_set_header Upgrade $http_upgrade; -# proxy_set_header Connection 'upgrade'; -# proxy_set_header Host $host; -# proxy_set_header X-Real-IP $remote_addr; -# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; -# proxy_cache_bypass $http_upgrade; -# client_max_body_size 10M; -# } \ No newline at end of file + external: true \ No newline at end of file diff --git a/init.sh b/init.sh new file mode 100644 index 0000000..e9daf9b --- /dev/null +++ b/init.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +# Create necessary directories if they don't exist +mkdir -p data +mkdir -p public/uploads + +# Set permissions +chmod -R 777 data +chmod -R 777 public/uploads + +echo "Directories created and permissions set" \ No newline at end of file