vitepress
vitepress copied to clipboard
Cannot build with docker buildkit on arm64
Describe the bug
Infinite loading during docker build
#15 [build 6/6] RUN npm run build
#15 1.187
#15 1.187 > [email protected] build
#15 1.187 > vitepress build
#15 1.187
#15 2.044
#15 2.044 vitepress v1.0.1
#15 2.044
#15 2.072 - building client + server bundles...
Reproduction
ARG NODE_IMAGE=node
ARG NODE_VERSION=20.11.1-alpine
ARG NGINX_IMAGE=nginx
ARG NGINX_VERSION=1.25.1-alpine
FROM $NODE_IMAGE:$NODE_VERSION as build
WORKDIR /app
COPY .npmrc package.json package-lock.json ./
RUN --mount=type=secret,id=TOKEN NPM_REGISTRY_TOKEN=$(cat /run/secrets/TOKEN) npm ci
COPY .vitepress content ./
RUN npm run build <<< **INFINITE PROGRESS**
FROM $NGINX_IMAGE:$NGINX_VERSION as final
# Настройка Nginx
RUN touch /var/run/nginx.pid \
&& chown -R nginx:nginx /var/cache/nginx /var/run/nginx.pid
COPY nginx.conf /etc/nginx/nginx.conf
COPY --from=build /app/.vitepress/dist/ /usr/share/nginx/html
USER nginx
EXPOSE 8080
ENTRYPOINT ["nginx", "-g", "daemon off;"]
Expected behavior
The build phase should be completed quickly
System Info
System:
OS: macOS 14.3.1
CPU: (8) arm64 Apple M1
Memory: 143.84 MB / 8.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 21.6.1 - /opt/homebrew/opt/node@20/bin/node
Yarn: 1.22.21 - /opt/homebrew/bin/yarn
npm: 10.2.4 - /opt/homebrew/opt/node@20/bin/npm
bun: 1.0.25 - /opt/homebrew/bin/bun
Browsers:
Chrome: 114.0.5735.198
Safari: 17.3.1
Additional context
No response
Validations
- [X] Check if you're on the latest VitePress version.
- [X] Follow our Code of Conduct
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Install git or disable lastUpdated. alpine doesn't have that installed by default.
Install git or disable lastUpdated. alpine doesn't have that installed by default.
It solved problem with git ENOET
, but But that's not the problem
@brc-dd Reopen please, you are wrong
Please share a minimal reproducible example.
@brc-dd github.com:polRk/vitpress-101-docker-bug.git
Run on Apple Silicon
I think the problem is that I am building an image for amd64 on arm64.
FROM --platform=linux/amd64. I need it line.
works fine on my mac:
=> [final 2/4] RUN touch /var/run/nginx.pid && chown -R nginx:nginx /var/cache/nginx /var/run/nginx.pid 0.1s
=> [final 3/4] COPY nginx.conf /etc/nginx/nginx.conf 0.0s
=> [build 5/6] COPY .vitepress content ./ 0.0s
=> [build 6/6] RUN npm run build 4.6s
=> [final 4/4] COPY --from=build /app/.vitepress/dist/ /usr/share/nginx/html 0.0s
Preview kind of breaks but you'll need to adjust CSP headers added by nginx for that.
me too. Stuck at this step. building an image for amd64 on arm64
[+] Building 1144.1s (14/17)
=> [stage-0 6/6] RUN npm run docs:build 987.4s
=> => # > docs:build
=> => # > vitepress build docs
=> => # vitepress v1.2.3
=> => # - building client + server bundles...