Docker compose file for production erros

default discord avatar
parthapaul7
9 months ago
1 1

I am facing lot of issues in the production of with docker-compose
here is my docker-compose.yml file

version: '3'`

services:

  payload:
    image: node:18-alpine
    ports:
      - "3000:3000"
    volumes:
      - .:/home/node/app
      - node_modules:/home/node/app/node_modules
      - media:/home/node/app/media
    working_dir: /home/node/app/
    command: sh -c "yarn install && yarn build && yarn serve"
    depends_on:
      - mongo
    environment:
      MONGODB_URI: mongodb://mongo:27017/payload
      PORT: 3000
      NODE_ENV: production 
      PAYLOAD_SECRET: TESTING

  mongo:
    image: mongo:latest
    ports:
      - "27017:27017"
    command:
      - --storageEngine=wiredTiger
    volumes:
      - data:/data/db
    logging:
      driver: none

volumes:
  data:
  node_modules:
  media:

it is showing errors like this

cms-payload-1  | $ yarn copyfiles && yarn build:payload && yarn build:server
cms-payload-1  | $ copyfiles -u 1 "src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png}" dist/
cms-payload-1  | /bin/sh: copyfiles: not found
cms-payload-1  | error Command failed with exit code 127.

Docker is working fine in development mode with yarn dev

  • discord user avatar
    JarrodMFlesch
    Payload Team
    9 months ago

    @parthapaul7 copyfiles is a devDependency, it is required to run yarn build so you will need to install it before running that command.

    Try command: sh -c "yarn add copyfiles && yarn install && yarn build && yarn serve"

Open the post
Continue the discussion in GitHub
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.