diff --git a/Dockerfile b/Dockerfile index eee7f5c..25658a9 100755 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,26 @@ # syntax=docker/dockerfile:1.4 -FROM node:20-alpine +FROM debian:bookworm-slim WORKDIR /app # Installation des dépendances minimales nécessaires -RUN apk update && apk upgrade && apk add --no-cache \ - git \ - curl \ - wget \ - jq \ - file \ - netcat-openbsd \ - && rm -rf /var/cache/apk/* /tmp/* /var/tmp/* +RUN apt-get update && apt-get upgrade -y && \ + apt-get install -y --fix-missing \ + ca-certificates curl jq git && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# Installation de Node.js +RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \ + apt-get install -y nodejs && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# Création d'un utilisateur non-root +RUN useradd -m -u 1000 appuser && \ + mkdir -p /app && chown -R appuser:appuser /app # Copy project files COPY . . +RUN chown -R appuser:appuser /app # Ensure pkg directory exists and has correct permissions RUN mkdir -p pkg && chmod -R 755 pkg @@ -28,15 +34,9 @@ RUN ls -la pkg/ && file pkg/sdk_client_bg.wasm # so no compilation is required here. # Installation des dépendances Node.js +USER appuser RUN npm install -# Copie de la configuration nginx -COPY nginx.dev.conf /etc/nginx/http.d/default.conf +EXPOSE 3003 -# Script de démarrage -COPY start-dev.sh /start-dev.sh -RUN chmod +x /start-dev.sh - -EXPOSE 3003 80 - -CMD ["/start-dev.sh"] +CMD ["npm", "start"]