Coder Social home page Coder Social logo

naskio / docker-strapi Goto Github PK

View Code? Open in Web Editor NEW
130.0 3.0 43.0 60 KB

Docker image for strapi v4 (latest version)

Home Page: https://hub.docker.com/r/naskio/strapi

License: MIT License

Dockerfile 27.96% Shell 72.04%
strapi strapi-cms docker docker-compose docker-image cms compose image headless v4

docker-strapi's Introduction

Hi there πŸ‘‹

docker-strapi's People

Contributors

jongon avatar naskio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

docker-strapi's Issues

Warning: An error occurred while requesting the API

That's what I get in the console of the browser, when trying to connect the first time to strapi:
Refused to connect to 'http://localhost:1337/admin/init' because it violates the following Content Security Policy directive: "connect-src 'self' https:".
Refused to connect to 'http://localhost:1337/admin/project-type' because it violates the following Content Security Policy directive: "connect-src 'self' https:".

Error: Network Error
    at M.exports (main.6dad6108.js:8014:7821)
    at E.onerror (main.6dad6108.js:8014:2814)

Also, I get the message from strapi:
Warning: An error occurred while requesting the API

arm support

can you also bult it for arm64 server ?

i'm using oracle arm server and would like to use this docker image on that server.

Container can't run, error: Node modules not installed

config:

strapi4:
    image: naskio/strapi:latest-alpine
    container_name: strapi4-alpine
    restart: unless-stopped
    tty: true
    ports:
      - "9447:1337"
    environment:
      NODE_ENV: development
      DATABASE_HOST: mariadb
      DATABASE_CLIENT: mysql
      DATABASE_NAME: xxx
      DATABASE_USERNAME: xxx
      DATABASE_PASSWORD: xxx
      DATABASE_PORT: 3306
    # volumes:
    #   - ./docker_data/strapiapp:/srv/app
    networks:
      - default

error:


 Node modules not installed. Installing using npm ...
audited 1651 packages in 55.141s

118 packages are looking for funding
  run `npm fund` for details

found 106 vulnerabilities (3 low, 27 moderate, 59 high, 17 critical)
  run `npm audit fix` to fix them, or `npm audit` for details
Starting your app (with develop)...
You need to run strapi develop in a Strapi project. Make sure you are in the right directory.
Node modules not installed. Installing using npm ...
audited 1651 packages in 58.853s

118 packages are looking for funding
  run `npm fund` for details

found 106 vulnerabilities (3 low, 27 moderate, 59 high, 17 critical)
  run `npm audit fix` to fix them, or `npm audit` for details
Starting your app (with develop)...
You need to run strapi develop in a Strapi project. Make sure you are in the right directory.
Node modules not installed. Installing using npm ...

Tried set volumes, recreate, and all got the same error. any help?

make: *** [sharp.target.mk:139: Release/obj.target/sharp/src/common.o] Error 1

make: Entering directory '/srv/app/node_modules/sharp/build'
CC(target) Release/obj.target/nothing/../node-addon-api/nothing.o
AR(target) Release/obj.target/../node-addon-api/nothing.a
COPY Release/nothing.a
TOUCH Release/obj.target/libvips-cpp.stamp
CXX(target) Release/obj.target/sharp/src/common.o
../src/common.cc:24:10: fatal error: vips/vips8: No such file or directory
#include <vips/vips8>
^~~~~~~~~~~~
compilation terminated.
make: Leaving directory '/srv/app/node_modules/sharp/build'
make: *** [sharp.target.mk:139: Release/obj.target/sharp/src/common.o] Error 1

[BUG] Error: Cannot find module 'mysql'

@naskio The latest STRAPI 4.15.0 container give back the following error message when install it:

Error: Cannot find module 'mysql'

[2023-11-01 11:29:40.969] debug: ⛔️ Server wasn't able to start properly.
[2023-11-01 11:29:40.971] error: Knex: run
$ npm install mysql --save
Cannot find module 'mysql'

Strapi env variables not working

Hi, first of all thanks for your work :)

I'm trying currently to pass some Strapi relevant env variables as PUBLIC_URL or HOST to start it in the development mode on my server but the admin panel get always build with default settings (localhost:1337). As soon as I navigate to the admin page I get:

main.3ca0e44c.js:7511 Refused to connect to 'http://localhost:1337/admin/init' because it violates the document's Content Security Policy.

It happens because Strapi doesn't now that it should use other host or public URL and run with defaults instead. Is there any way I can change this behavior?

Exited with Code 0

Hi there,

Is there anything I need installed on my server before this will work?
I'm currently trying to run it on a pretty vanilla debian 11 install, and it always exits on start up with error code 0.

Is VOLUME declaration really intended?

Hi,
I struggle to bind to this container. Now I read, that using VOLUME inside the dockerfile means, that it is just not possible, so there is no way to sync the running data from the container on the host and thus cannot backup the app etc.
Tell me I am wrong or tell me, why you intended that.
Of course it is possible to create a fork and remove the VOLUME command in the dockerfile, but why don't you do that here?

Thanks for your feedback
:ollix

Cannot initialize project - An error occurred while requesting the API

Hi,
when I start the docker container from fresh (doesn't matter if its sqlite or posgres) everything seems to work fine.
But calling the admin console gives a warning:
"An error occurred while rewuesting the API"
and then the loading spinner never terminates .

In the containers log there is no error or warning.
In the browser console I see:
Content Security Policy: The page’s settings blocked the loading of a resource at http://localhost:1337/admin/project-type (β€œconnect-src”).
Content Security Policy: The page’s settings blocked the loading of a resource at http://localhost:1337/admin/init (β€œconnect-src”).

Latest image not working

When I fetch the latest image, this is not working, neither latest-alpine nor latest. I tried to start a fresh installation and I get following error:

Attaching to strapi-1
strapi-1 | node:internal/modules/cjs/loader:1137
strapi-1 | throw err;
strapi-1 | ^
strapi-1 |
strapi-1 | Error: Cannot find module 'react'
strapi-1 | Require stack:
strapi-1 | - /usr/local/share/.config/yarn/global/node_modules/@strapi/admin/dist/_chunks/index-sNH2VWbC.js
strapi-1 | - /usr/local/share/.config/yarn/global/node_modules/@strapi/admin/dist/cli.js
strapi-1 | - /usr/local/share/.config/yarn/global/node_modules/@strapi/admin/index.js
strapi-1 | - /usr/local/share/.config/yarn/global/node_modules/@strapi/strapi/dist/commands/actions/watch-admin/action.js
strapi-1 | - /usr/local/share/.config/yarn/global/node_modules/@strapi/strapi/dist/commands/actions/watch-admin/command.js
strapi-1 | - /usr/local/share/.config/yarn/global/node_modules/@strapi/strapi/dist/commands/index.js
strapi-1 | - /usr/local/share/.config/yarn/global/node_modules/@strapi/strapi/dist/cli.js
strapi-1 | - /usr/local/share/.config/yarn/global/node_modules/@strapi/strapi/bin/strapi.js
strapi-1 | at Module._resolveFilename (node:internal/modules/cjs/loader:1134:15)
strapi-1 | at Module._load (node:internal/modules/cjs/loader:975:27)
strapi-1 | at Module.require (node:internal/modules/cjs/loader:1225:19)
strapi-1 | at require (node:internal/modules/helpers:177:18)
strapi-1 | at Object. (/usr/local/share/.config/yarn/global/node_modules/@strapi/admin/dist/_chunks/index-sNH2VWbC.js:15:15)
strapi-1 | at Module._compile (node:internal/modules/cjs/loader:1356:14)
strapi-1 | at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
strapi-1 | at Module.load (node:internal/modules/cjs/loader:1197:32)
strapi-1 | at Module._load (node:internal/modules/cjs/loader:1013:12)
strapi-1 | at Module.require (node:internal/modules/cjs/loader:1225:19) {
strapi-1 | code: 'MODULE_NOT_FOUND',
strapi-1 | requireStack: [
strapi-1 | '/usr/local/share/.config/yarn/global/node_modules/@strapi/admin/dist/_chunks/index-sNH2VWbC.js',
strapi-1 | '/usr/local/share/.config/yarn/global/node_modules/@strapi/admin/dist/cli.js',
strapi-1 | '/usr/local/share/.config/yarn/global/node_modules/@strapi/admin/index.js',
strapi-1 | '/usr/local/share/.config/yarn/global/node_modules/@strapi/strapi/dist/commands/actions/watch-admin/action.js',
strapi-1 | '/usr/local/share/.config/yarn/global/node_modules/@strapi/strapi/dist/commands/actions/watch-admin/command.js',
strapi-1 | '/usr/local/share/.config/yarn/global/node_modules/@strapi/strapi/dist/commands/index.js',
strapi-1 | '/usr/local/share/.config/yarn/global/node_modules/@strapi/strapi/dist/cli.js',
strapi-1 | '/usr/local/share/.config/yarn/global/node_modules/@strapi/strapi/bin/strapi.js'
strapi-1 | ]
strapi-1 | }
strapi-1 |
strapi-1 | Node.js v18.19.0
strapi-1 | Using strapi
strapi-1 | No project found at /srv/app. Creating a new strapi project ...
strapi-1 | node:internal/modules/cjs/loader:1137
strapi-1 | throw err;
strapi-1 | ^
strapi-1 |
strapi-1 | Error: Cannot find module 'react'
strapi-1 | Require stack:
strapi-1 | - /usr/local/share/.config/yarn/global/node_modules/@strapi/admin/dist/_chunks/index-sNH2VWbC.js
strapi-1 | - /usr/local/share/.config/yarn/global/node_modules/@strapi/admin/dist/cli.js
strapi-1 | - /usr/local/share/.config/yarn/global/node_modules/@strapi/admin/index.js
strapi-1 | - /usr/local/share/.config/yarn/global/node_modules/@strapi/strapi/dist/commands/actions/watch-admin/action.js
strapi-1 | - /usr/local/share/.config/yarn/global/node_modules/@strapi/strapi/dist/commands/actions/watch-admin/command.js
strapi-1 | - /usr/local/share/.config/yarn/global/node_modules/@strapi/strapi/dist/commands/index.js
strapi-1 | - /usr/local/share/.config/yarn/global/node_modules/@strapi/strapi/dist/cli.js
strapi-1 | - /usr/local/share/.config/yarn/global/node_modules/@strapi/strapi/bin/strapi.js
strapi-1 | at Module._resolveFilename (node:internal/modules/cjs/loader:1134:15)
strapi-1 | at Module._load (node:internal/modules/cjs/loader:975:27)
strapi-1 | at Module.require (node:internal/modules/cjs/loader:1225:19)
strapi-1 | at require (node:internal/modules/helpers:177:18)
strapi-1 | at Object. (/usr/local/share/.config/yarn/global/node_modules/@strapi/admin/dist/_chunks/index-sNH2VWbC.js:15:15)
strapi-1 | at Module._compile (node:internal/modules/cjs/loader:1356:14)
strapi-1 | at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
strapi-1 | at Module.load (node:internal/modules/cjs/loader:1197:32)
strapi-1 | at Module._load (node:internal/modules/cjs/loader:1013:12)
strapi-1 | at Module.require (node:internal/modules/cjs/loader:1225:19) {
strapi-1 | code: 'MODULE_NOT_FOUND',
strapi-1 | requireStack: [
strapi-1 | '/usr/local/share/.config/yarn/global/node_modules/@strapi/admin/dist/_chunks/index-sNH2VWbC.js',
strapi-1 | '/usr/local/share/.config/yarn/global/node_modules/@strapi/admin/dist/cli.js',
strapi-1 | '/usr/local/share/.config/yarn/global/node_modules/@strapi/admin/index.js',
strapi-1 | '/usr/local/share/.config/yarn/global/node_modules/@strapi/strapi/dist/commands/actions/watch-admin/action.js',
strapi-1 | '/usr/local/share/.config/yarn/global/node_modules/@strapi/strapi/dist/commands/actions/watch-admin/command.js',
strapi-1 | '/usr/local/share/.config/yarn/global/node_modules/@strapi/strapi/dist/commands/index.js',
strapi-1 | '/usr/local/share/.config/yarn/global/node_modules/@strapi/strapi/dist/cli.js',
strapi-1 | '/usr/local/share/.config/yarn/global/node_modules/@strapi/strapi/bin/strapi.js'
strapi-1 | ]
strapi-1 | }
strapi-1 |
strapi-1 | Node.js v18.19.0
strapi-1 exited with code 1

Refused to connect to 'http://localhost:1337/admin/project-type' to Strapi in k8s

Hi!

I would like to ask you help to solve the issue when you deploy the image ( the latest one) to kubernetes. It is up and running and it is available thru ingress, yet /admin doesn't work properly and you can see the following errors in the console.

admin:1 Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-bG7bn3LjdHcCH2ZHSejHnSWxixr/KhYaBobyVrfB8g4='), or a nonce ('nonce-...') is required to enable inline execution.

main.1f8cc299.js:2856 Refused to connect to 'http://localhost:1337/admin/project-type' because it violates the following Content Security Policy directive: "connect-src 'self' https:".

(anonymous) @ main.1f8cc299.js:2856
xhr @ main.1f8cc299.js:2856
$e @ main.1f8cc299.js:2856
Promise.then (async)
request @ main.1f8cc299.js:2856
Fn.<computed> @ main.1f8cc299.js:2856
(anonymous) @ main.1f8cc299.js:2854
get @ main.1f8cc299.js:955
(anonymous) @ main.1f8cc299.js:452
32741 @ main.1f8cc299.js:452
e @ runtime~main.80a43c16.js:1
x @ main.1f8cc299.js:2856
(anonymous) @ main.1f8cc299.js:2856
i @ runtime~main.80a43c16.js:2
(anonymous) @ main.1f8cc299.js:1
main.1f8cc299.js:452 QtΒ {message: 'Network Error', name: 'AxiosError', code: 'ERR_NETWORK', config: {…}, request: XMLHttpRequest, …}
(anonymous) @ main.1f8cc299.js:452
await in (anonymous) (async)
32741 @ main.1f8cc299.js:452
e @ runtime~main.80a43c16.js:1
x @ main.1f8cc299.js:2856
(anonymous) @ main.1f8cc299.js:2856
i @ runtime~main.80a43c16.js:2
(anonymous) @ main.1f8cc299.js:1
main.1f8cc299.js:2856 Refused to connect to 'http://localhost:1337/admin/init' because it violates the following Content Security Policy directive: "connect-src 'self' https:".

strapi has the following output

Actions available

One more thing...
Create your first administrator πŸ’» by going to the administration panel at:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ http://0.0.0.0:1337/admin β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

[2023-08-11 12:44:23.767] http: GET /admin (21 ms) 200
[2023-08-11 12:44:23.842] http: GET /admin/runtime~main.80a43c16.js (9 ms) 200
[2023-08-11 12:44:23.843] http: GET /admin/main.1f8cc299.js (3 ms) 200
[2023-08-11 12:44:24.786] http: GET /favicon.ico (1 ms) 200
[2023-08-11 12:44:30.144] http: GET /admin (2 ms) 200
[2023-08-11 12:44:30.196] http: GET /admin/runtime~main.80a43c16.js (1 ms) 200
[2023-08-11 12:44:30.200] http: GET /admin/main.1f8cc299.js (1 ms) 200
[2023-08-11 12:44:31.862] http: GET /favicon.ico (0 ms) 200
[2023-08-11 12:45:41.648] http: GET /admin (2 ms) 200
[2023-08-11 12:45:41.737] http: GET /admin/main.1f8cc299.js (3 ms) 200
[2023-08-11 12:45:41.738] http: GET /admin/runtime~main.80a43c16.js (2 ms) 200
[2023-08-11 12:45:42.688] http: GET /favicon.ico (0 ms) 200
[2023-08-11 12:47:10.666] http: GET /admin (2 ms) 200
[2023-08-11 12:47:10.737] http: GET /admin/runtime~main.80a43c16.js (2 ms) 200
[2023-08-11 12:47:10.741] http: GET /admin/main.1f8cc299.js (1 ms) 200
[2023-08-11 12:47:12.557] http: GET /favicon.ico (0 ms) 200

and I pass the ADMIN_URL and PUBLIC_URL
ADMIN_URL=https://strapi.domain/admin
PUBLIC_URL=https://strapi.domain

How to upgrade the application correctly

Hi,

There are lines at the docker-entrypoint file:

elif [ ! -d "node_modules" ] || [ ! "$(ls -qAL node_modules 2>/dev/null)" ]; then
if [ -f "yarn.lock" ]; then
echo "Node modules not installed. Installing using yarn ..."
yarn install --prod --silent
else
echo "Node modules not installed. Installing using npm ..."
npm install --only=prod --silent
fi

If we upgrade strapio to the newer version, docker-entrypoint sees that the node_modules folder exists and wont install the upgrades if there are any. How to perform here correctly?

Request hit localhost after deploy to production

When I deploy this project in production, the API keeps hitting localhost, even my strapi is deployed in a real domain with HTTPS.

Is there any environment variable for this?

I couldn't find it

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.