Reputation: 3516
As already mentioned, we cannot use dynamic routes with next export. For example, I have /post/:id, where the identifier cannot be predefined. I heard about npm run start, but I don’t know how to deploy in this way. I use Caddy instead of NGINX. The main problem is how to build next.js SSR. When I do SPA I setup NGINX in Dockerfile and copy out/ folder to /usr/share/nginx/html. But in SSR I need to start node.js server and here I have problems.
Upvotes: 1
Views: 509
Reputation: 3516
The question is closed, my problem was that I didn't copy src/
folder.
Dockerfile:
FROM node:alpine
RUN mkdir -p /app
WORKDIR /app
COPY package*.json ./
COPY src/ ./src/
COPY public/ ./public/
RUN npm install
RUN npm run build
EXPOSE 80
CMD ["npm", "start"]
Upvotes: 1