strapi / strapi-docker

Install and run your first Strapi project using Docker
https://strapi.io
MIT License
1.17k stars 445 forks source link

Can not build a image by current package.json #253

Closed wujun4code closed 3 years ago

wujun4code commented 3 years ago

I use the master branch package.json and yarn.lock file together with Dockerfile:

FROM strapi/base

WORKDIR /my-path

COPY ./package.json ./
COPY ./yarn.lock ./

RUN yarn install

COPY . .

ENV NODE_ENV production

RUN yarn build

EXPOSE 1337

CMD ["yarn", "start"]
$ docker build .
Sending build context to Docker daemon  55.81kB
Step 1/12 : FROM strapi/base
 ---> 24bbbc9e3918
Step 2/12 : WORKDIR /my-path
 ---> Using cache
 ---> dd84d2d1be54
Step 3/12 : COPY ./package.json ./
 ---> Using cache
 ---> 280705cfb45f
Step 4/12 : COPY ./yarn.lock ./
 ---> Using cache
 ---> a42908d00ef3
Step 5/12 : RUN npm config set registry http://mirrors.cloud.tencent.com/npm/
 ---> Using cache
 ---> 19331a4a2cfc
Step 6/12 : RUN yarn config set registry http://mirrors.cloud.tencent.com/npm/
 ---> Using cache
 ---> e4327286e9eb
Step 7/12 : RUN yarn install
 ---> Using cache
 ---> 4f755e41cf47
Step 8/12 : COPY . .
 ---> Using cache
 ---> f47a2a65223a
Step 9/12 : ENV NODE_ENV production
 ---> Using cache
 ---> d79e1c682c11
Step 10/12 : RUN yarn run build
 ---> Running in a5c11111f1f5
yarn run v1.22.4
error Command "build" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The command '/bin/sh -c yarn run build' returned a non-zero code: 1
wujun4code commented 3 years ago

I think maybe the build config script missing?

"scripts": {
    "build": "missing config here"
}