strapi / strapi-docker

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

docker build failed #255

Closed wujun4code closed 3 years ago

wujun4code commented 3 years ago

I cloned the source code from https://github.com/strapi/strapi, and add the following dockerfile in root folder,

FROM strapi/base

WORKDIR /srv/app

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

RUN yarn install

COPY . .

ENV NODE_ENV production

RUN yarn build

EXPOSE 1337

CMD ["yarn", "start"]

then run build it,

$ docker build .

the following error i got:

$ docker build .
Sending build context to Docker daemon    540MB
Step 1/10 : FROM strapi/base
 ---> 24bbbc9e3918
Step 2/10 : WORKDIR /srv/app
 ---> Using cache
 ---> c906537aaf23
Step 3/10 : COPY ./package.json ./
 ---> Using cache
 ---> 24aa52bfef97
Step 4/10 : COPY ./yarn.lock ./
 ---> Using cache
 ---> c6fc654a942b
Step 5/10 : RUN yarn install
 ---> Using cache
 ---> d300204750d2
Step 6/10 : COPY . .
 ---> Using cache
 ---> 430c601962d6
Step 7/10 : ENV NODE_ENV production
 ---> Using cache
 ---> 21c6c8341fdc
Step 8/10 : RUN yarn build
 ---> Running in c8e2c9b0aa3f
yarn run v1.22.4
$ lerna run --stream build --no-private
lerna notice cli v3.22.1
lerna info Executing command in 1 package: "yarn run build"
strapi-helper-plugin: $ rimraf dist
strapi-helper-plugin: $ rollup -c
strapi-helper-plugin: /bin/sh: 1: rollup: not found
strapi-helper-plugin: error Command failed with exit code 127.
strapi-helper-plugin: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
lerna ERR! yarn run build exited 127 in 'strapi-helper-plugin'
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The command '/bin/sh -c yarn build' returned a non-zero code: 127
alexandrebodin commented 3 years ago

Hello cloning the strapi repo is not the way you create a strapi app. You need to use the command line tool to create an app. You can read the documentation here https://strapi.io/documentation/v3.x/getting-started/installation.html#installation-guides