Imagine docker pentru nuxt3 si prisma

Salut,
Incerc sa creez o imagine docker pentru nuxt3 si prisma si nu imi dau seama unde este greseala. Este prima data cand am prisma intr-un proiect.
Dockerfile-ul meu arata pana acum asa :

# https://towardsserverless.com/articles/deploying-nuxt-3-ssr-webapp-with-docker
FROM node:18-alpine3.17 as build

# update and install the latest dependencies
# Add non root user to the docker image and set the user
RUN apk update && apk upgrade && adduser -D nuxtuser

USER nuxtuser

# set work dir as app
WORKDIR /app
# copy the nuxt project content with proper permission for the user nuxtuser
COPY --chown=nuxtuser:nuxtuser . /app
# COPY . ./
# install all the project npm dependencies
# build the nuxt project to generate the artifacts in .output directory
RUN npm install && npx nuxt build

# we are using multi stage build process to keep the image size as small as possible
FROM node:18-alpine3.17
# update and install latest dependencies, add dumb-init package
# add a non root user
RUN apk update && apk upgrade && apk add dumb-init && adduser -D nuxtuser 
# set non root user
USER nuxtuser

# set work dir as app
WORKDIR /app
# copy the output directory to the /app directory from 
# build stage with proper permissions for user nuxt user
COPY --chown=nuxtuser:nuxtuser --from=build /app/.output ./
# copy the prisma tirectory to the /app diectory
COPY --chown=nuxtuser:nuxtuser ./prisma ./prisma
# expose 8080 on container
EXPOSE 8080

# set app host and port . In nuxt 3 this is based on nitor and you can read
#more on this https://nitro.unjs.io/deploy/node#environment-variables
ENV HOST=0.0.0.0 PORT=8080 NODE_ENV=production 
# Env for prisma
ENV PRISMA_MIGRATION_DIR=/app/prisma/migrations
# start the app with dumb init to spawn the Node.js runtime process
# with signal support
CMD ["dumb-init","node","/app/server/index.mjs"]

# BB: as e entrypoiunt I want to run migrations
ENTRYPOINT [ "ash", "-c", "npx prisma migrate deploy --preview-feature" ]```

Un dockerfile contine un singur serviciu.
Daca vrei sa le combini iti trebuie docker-compose sau kubernetes. (helm chart de exemplu)

CMD ["dumb-init","node","/app/server/index.mjs"]

# BB: as e entrypoiunt I want to run migrations
ENTRYPOINT [ "ash", "-c", "npx prisma migrate deploy --preview-feature" ]```

Ai putea rula node cu un process manager in background si atunci iti ramane shell-ul pentru npx, cred ca node ruleaza si nu mai poate rula npx.

Pentru a rezolva problema de mai sus am sters cmd-ul si am lasat doar entrypoint, numai ca din entrypoint am rulat 2 comenzi linux cu &&
Am mai reusit sa avansez, dar mai am 2 probleme:

  • cand frontendul cheama backendul la adresa localhost:3000 desi este setat ca 0.0.0.0 si backend_url-ul este setat pe domeniu.
  • am chemat manual /api/… si imi intoarce o eroare ca nu gaseste prisma-client.
    P.S: Dupa ce fac lucrurile sa mearga o sa postez si aici solutia