Next.js Discord

Discord Forum

Docker - Only one route available

Unanswered
Ninhache posted this in #help-forum
Open in Discord
Hi, i've tried to "deploy" my project locally using docker using this dockerfile :

FROM node:18-alpine
WORKDIR /app
COPY package.json yarn.lock* package-lock.json* ./
# build les dépendances
RUN yarn --frozen-lockfile 

# copy les sources et on build l'app
COPY . .
RUN yarn build

# run de l'app
EXPOSE 3000
ENV PORT 3000

WORKDIR /app/.next/standalone
CMD ["node", "server.js"]


But, i'm keep getting only 1 route available, the / one.. all the others routes arnt available and i'm keep getting :
This site can’t be reachedThe webpage at http://localhost:3000/?login=true might be temporarily down or it may have moved permanently to a new web address.
ERR_FAILED


Anyone ever see this ? 🤓

3 Replies

@Ninhache maybe static dir is missing. actually you might want to use the official example from Vercel. I use it (bit tweaked) and it works fine.
https://github.com/vercel/next.js/blob/canary/examples/with-docker/Dockerfile
my advise is, you might want to get into the docker container by getting the shell, then make sure that all files are placed right. then launch a Next.js from the container.