From b282e9fc009dc285f68909a2519868b4aee73715 Mon Sep 17 00:00:00 2001 From: "[dyad]" Date: Thu, 6 Nov 2025 14:53:41 +0100 Subject: [PATCH] [dyad] wrote 4 file(s) --- Dockerfile | 23 ++++----- package.json | 13 ++--- public/index.html | 127 ++-------------------------------------------- server.js | 10 +++- 4 files changed, 32 insertions(+), 141 deletions(-) diff --git a/Dockerfile b/Dockerfile index c7229ee..09c2b76 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,25 +1,24 @@ FROM node:18-alpine -# Create app directory and set permissions -WORKDIR /home/node/app +WORKDIR /app + +# Install build dependencies +RUN apk add --no-cache python3 make g++ + +# Copy package files +COPY package*.json ./ # Install dependencies -COPY package*.json ./ RUN npm install -# Copy app source +# Copy source code COPY . . -# Create directories with proper permissions -RUN mkdir -p /home/node/app/data /home/node/app/public/uploads && \ - chown -R node:node /home/node/app && \ - chmod -R 777 /home/node/app/data /home/node/app/public/uploads - -# Switch to non-root user -USER node +# Build CSS +RUN npm run build:css # Expose port EXPOSE 2222 # Start the application -CMD ["node", "server.js"] \ No newline at end of file +CMD ["npm", "start"] \ No newline at end of file diff --git a/package.json b/package.json index 55393c2..c8e663b 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "start": "node server.js", "dev": "nodemon server.js", - "build:css": "tailwindcss -i ./src/styles.css -o ./public/css/styles.css --watch" + "build:css": "tailwindcss -i ./public/css/styles.css -o ./public/css/dist/styles.css --minify" }, "dependencies": { "bcrypt": "^5.1.1", @@ -19,12 +19,13 @@ "multer": "^1.4.5-lts.1", "sqlite3": "^5.1.7", "uuid": "^9.0.1", - "winston": "^3.11.0" + "winston": "^3.11.0", + "tailwindcss": "^3.3.5", + "autoprefixer": "^10.4.16", + "postcss": "^8.4.31", + "postcss-cli": "^10.1.0" }, "devDependencies": { - "autoprefixer": "^10.4.16", - "nodemon": "^3.0.3", - "postcss": "^8.4.31", - "tailwindcss": "^3.3.5" + "nodemon": "^3.0.3" } } \ No newline at end of file diff --git a/public/index.html b/public/index.html index bd43842..3504cfa 100644 --- a/public/index.html +++ b/public/index.html @@ -4,128 +4,11 @@ Notes & Todos - - + + - - -
-
-

Connexion

-
-
- - -
-
- - -
- -
-
-
- - - - - - - - + + + \ No newline at end of file diff --git a/server.js b/server.js index 8b737fb..2c8827a 100644 --- a/server.js +++ b/server.js @@ -42,7 +42,15 @@ app.use(helmet({ })); app.use(cors()); app.use(express.json()); -app.use(express.static('public')); + +// Serve static files with correct MIME types +app.use(express.static('public', { + setHeaders: (res, path) => { + if (path.endsWith('.css')) { + res.setHeader('Content-Type', 'text/css'); + } + } +})); // Set JWT_SECRET environment variable if not set if (!process.env.JWT_SECRET) {