FROM hugomods/hugo:latest

# Installe Node.js et npm
USER root
RUN apk add --no-cache nodejs npm git

WORKDIR /src

# Copie package.json et package-lock.json si présent
COPY package.json ./
COPY package-lock.json ./


# Installation des dépendances
RUN npm install --save-dev sass

# Build CSS (tailwind + scss)
RUN npm run build

# Copie le reste du code
COPY . .

EXPOSE 1313

CMD ["hugo", "server", "-D", "--bind", "0.0.0.0", "--baseURL", "http://localhost:1313", "--appendPort=false"]
