Files

20 lines
733 B
Docker
Raw Permalink Normal View History

### Stage 1: Build the site with Hugo Extended + Node (Tailwind runs inside Hugo)
FROM hugomods/hugo:debian-node-0.165.0 AS hugo
WORKDIR /site
# Install JS deps first so this layer caches independently of content changes.
# Hugo's css.TailwindCSS execs node_modules/.bin/tailwindcss during the build;
# pnpm-workspace.yaml sets preferSymlinkedExecutables so that shim is a symlink
# Hugo accepts.
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
RUN npm install -g pnpm && pnpm install --frozen-lockfile
COPY . .
RUN hugo --minify --gc --environment production
### Stage 2: Serve with nginx
FROM nginx:1.27-alpine
COPY --from=hugo /site/public /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80