Skip to content

Copying generated file to www folder to be served by nginx doesn´t work  #4219

Open
@CyberSeppi

Description

@CyberSeppi

Describe the bug

Hi,
I´m trying to create a dockerimage to serve out vitepress generated files, but the resulting site doesn´t include /vue. So the search function (and others) doesn´t´work.
2024-09-20 09_03_15-Screenshot

The docker build is multistage, so first configure the builder and generate the files (in dev mode it works), and then copy the /dist folder (output folder) to /var/www/my-site and use the nginx template in vitepress docs (slightly modified with custom folders)

Reproduction

FROM node:current-alpine as builder

WORKDIR /builder

RUN apk update

COPY /.site/package.json /builder/
COPY /.site/.vitepress/config.mts /builder/.vitepress/
COPY --exclude=/.site/ --exclude=.github/ --exclude=.gitignore --exclude=Dockerfile --exclude=.git/ . /builder/docs/
RUN npm install

RUN npm run docs:build

FROM nginx:1.27.1-alpine

COPY --from=builder /builder/.vitepress/dist /var/www/docs
RUN chown -R nginx:nginx /var/www/ -R
COPY ./.site/nginx/nginx.conf /etc/nginx/conf.d/default.conf

Expected behavior

The site should work as in dev mode (vue components work as intended)

System Info

System:
    OS: Linux 5.10 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
    CPU: (28) x64 13th Gen Intel(R) Core(TM) i7-13850HX
    Memory: 21.44 GB / 24.77 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 22.8.0 - ~/.nvm/versions/node/v22.8.0/bin/node
    npm: 10.8.2 - ~/.nvm/versions/node/v22.8.0/bin/npm
  npmPackages:
    vitepress: @1.3.4 => 1.3.4

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions