paulywill
paulywill

Reputation: 683

docker-compose not recognizing prisma generate or changes

I have several docker images I'm trying combine using docker-compose.

My server image is failing with the following:

server_1  | 
server_1  | To solve this problem, add the platform "linux-musl" to the "binaryTargets" attribute in the "generator" block in the "schema.prisma" file:
server_1  | generator client {
server_1  |   provider      = "prisma-client-js"
server_1  |   binaryTargets = ["native"]
server_1  | }
server_1  | 
server_1  | Then run "prisma generate" for your changes to take effect.

I go into the server directory and make the changes as suggested to scheme.prisma:

generator client {
  provider = "prisma-client-js"
  binaryTargets = ["native", "linux-musl"]
}

And yet when I try docker-compose up again it fails on the same error.

I have deleted node_modules multiple times and tried npx prisma generate but it's almost as if docker-compose is using the same old images.

I've also tried docker-compose up --force-recreate without luck.

My docker-compose.yml:

version: '3.4'

services:
  server:
    env_file: .env
    build: ./server
    working_dir: /usr/loft/server
    environment:
      - DATABASE_URL=postgresql://my_dbase_info
    ports:
      - "5000:5000"
    networks:
      - loft-app

  client: 
    depends_on:
        - server
    build: ./client
    stdin_open: true
    ports:
      - "3000:3000"
    working_dir: /usr/loft/client
    networks:
      - loft-app

  nginx:
    depends_on:
      - server
      - client
    restart: always
    build:
      dockerfile: Dockerfile
      context: ./nginx
    ports:
      - "8080:80"
    networks:
      - loft-app

networks:
  loft-app:
    driver: bridge

my server Dockerfile:

FROM node:17-alpine
WORKDIR /usr/loft/server
ARG DATABASE_URL=""
ENV DATABASE_URL $DATABASE_URL
# Bundle app source
COPY . .

# Install app dependencies
RUN npm i -g npm@8 && npm i
RUN npx prisma generate

EXPOSE 5000

CMD [ "npm","run","prod" ]

Upvotes: 1

Views: 3343

Answers (1)

paulywill
paulywill

Reputation: 683

I found the answer located in this article

$ docker-compose build
$ docker-compose up --force-recreate

Upvotes: 1

Related Questions