2

Hi all I have this Dockerfile:

FROM node:16.14-alpine as build

RUN npx create-docusaurus@latest project classic
WORKDIR /project
COPY ./docs/docusaurus/* docs
RUN npm run build
    
FROM nginx:1.17.4-alpine as serve
RUN echo $'server { \n\
  listen 8080; \n\
  root /usr/share/nginx/html; \n\
  index index.html; \n\
  server_name _; \n\
  location / { \n\
    try_files $uri $uri/ /index.html =404; \n\
  } \n\
}' > /etc/nginx/conf.d/default.conf
COPY --from=build /project/build/ /usr/share/nginx/html
EXPOSE 8080

I'm trying to execute a multi-stage docker container where at the first moment I simply create the static files and make the build using the suggested command from the documentation npm run build at the second stage I run the nginx service copying in the folder of nginx the generated files from the build.

My problem is that when I try to copy with this command from the other stage with: COPY --from=build /project/build/ /usr/share/nginx/html I cannot see the copied files in the second stage.

Docker commands I run are:

  1. docker build -t docusaurus-doc -f docker/Dockerfile.docusaurus .
  2. docker run -it -p 8080:8080 docusaurus-doc

(in the ./docs/docusaurus local folder I have some .md to publish on docusaurus)

Fulvio
  • 87
  • 7

0 Answers0