strapi-docker icon indicating copy to clipboard operation
strapi-docker copied to clipboard

Node v14 not found

Open tw1t611 opened this issue 3 years ago • 1 comments

I tried to use strapi with node v14. I need the newer version of Intl. api.

docker-compoes.yml:

image: strapi/strapi:3.6.3-node14

error:

ERROR: manifest for strapi/strapi:3.6.3-node14 not found: manifest unknown: manifest unknown

strapi/strapi:latest should be the same and was found, but comes with node v12, which does not come with full-icu.

tw1t611 avatar Jun 10 '21 06:06 tw1t611

For anyone else who needs the update, create these files in strapi folder.

Dockerfile:

FROM node:14

RUN yarn global add strapi

RUN mkdir /srv/app && chown 1000:1000 -R /srv/app
WORKDIR /srv/app

COPY . .
RUN yarn
RUN yarn add sharp

ENTRYPOINT ["docker-entrypoint.sh"]

EXPOSE 1337

CMD ["strapi", "develop"]

docker-entrypoint.sh:

#!/bin/sh
set -ea

if [ "$1" = "strapi" ]; then

  if [ ! -f "package.json" ]; then

    DATABASE_CLIENT=${DATABASE_CLIENT:-sqlite}

    EXTRA_ARGS=${EXTRA_ARGS}

    echo "Using strapi $(strapi version)"
    echo "No project found at /srv/app. Creating a new strapi project"

    DOCKER=true strapi new . \
      --dbclient=$DATABASE_CLIENT \
      --dbhost=$DATABASE_HOST \
      --dbport=$DATABASE_PORT \
      --dbname=$DATABASE_NAME \
      --dbusername=$DATABASE_USERNAME \
      --dbpassword=$DATABASE_PASSWORD \
      --dbssl=$DATABASE_SSL \
      $EXTRA_ARGS

  elif [ ! -d "node_modules" ] || [ ! "$(ls -qAL node_modules 2>/dev/null)" ]; then

    echo "Node modules not installed. Installing..."

    if [ -f "yarn.lock" ]; then

      yarn install

    else

      npm install

    fi

  fi

fi

echo "Starting your app..."

exec "$@"

.dockerignore:

node_modules
npm-debug.log
Dockerfile
.dockerignore
.git
.gitignore
.strapi-updater.json
build
.cach

Run

docker build -t strapi-dev .

and add strapi-dev to your docker-compose.yml

tw1t611 avatar Jun 24 '21 06:06 tw1t611