docker-wagtail-develop icon indicating copy to clipboard operation
docker-wagtail-develop copied to clipboard

Error Building Frontend Assets in Docker Setup

Open rohitsrma opened this issue 2 years ago • 3 comments

I'm encountering an issue while trying to use "docker-compose build" for setting up wagtail project using Docker. The issue seems to be related to the COPY command for the package.json and package-lock.json files in the Dockerfile.frontend.

Error Details: During the Docker build process for the frontend service, I'm seeing the following error message:

`failed to solve: failed to compute cache key: failed to calculate checksum of ref e1bce70e-3120-4a7b-99ba-53a746beadee::4yljc7iekkcpqwccr7citf7g3: "/wagtail/package.json": not found
`

Dockerfile.frontend:

`FROM node:18-slim
LABEL maintainer="[email protected]"

RUN apt-get update && apt-get install rsync -y
COPY ./wagtail/package.json ./wagtail/package-lock.json ./

RUN npm --prefix / install --loglevel info
`

docker-compose.yml:

`services:
---------
        frontend:
    container_name: "frontend"
    build:
      context: .
      dockerfile: Dockerfile.frontend
    working_dir: /code/wagtail
    volumes:
      - ./wagtail:/code/wagtail:delegated,rw
      - node_modules:/code/wagtail/node_modules/
    command: bash -c "echo 'Copying node_modules, this may take a few minutes...' && rsync -rah --info=progress2 /node_modules /code/wagtail/ && npm run start"
    restart: "no"
    tty: true
`

Troubleshooting Steps Taken:

  • Verified correct paths and file locations in Dockerfile and docker-compose.yml.
  • Checked Docker build context.
  • Ensured proper file permissions.

Additional Notes: I have tried several solutions based on the suggestions in the Wagtail documentation and other sources, but I'm still unable to resolve the issue. The error seems to be related to the COPY step for the package.json and package-lock.json files.

Any help or guidance in troubleshooting and resolving this issue would be greatly appreciated.

Thank you!

rohitsrma avatar Aug 07 '23 10:08 rohitsrma

Thank you @rohitsrma, we will investigate

saevarom avatar Aug 08 '23 09:08 saevarom

We've had another new contributor run into this.

lb- avatar Sep 27 '23 07:09 lb-

Just had another new contributor run into this problem

lb- avatar Dec 04 '23 08:12 lb-