naskio / docker-strapi Goto Github PK
View Code? Open in Web Editor NEWDocker image for strapi v4 (latest version)
Home Page: https://hub.docker.com/r/naskio/strapi
License: MIT License
Docker image for strapi v4 (latest version)
Home Page: https://hub.docker.com/r/naskio/strapi
License: MIT License
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
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.
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: 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
@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'
New Strapi version 4.6.1 is out.
I saw platform is commented out here
Wht not enable it?
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?
The docker-compose file in /examples is invalid
ERROR: The Compose file './docker-compose.yaml' is invalid because:
services.strapi-v4.environment.DATABASE_SSL contains false, which is an invalid type, it should be a string, number, or a null
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.
@naskio Can't access serverip:1337/admin because I receive Warning: An error occurred while requesting the API
:latest tag 4.5.0
PUBLIC_URL is set to `https://s.example.com' via docker-compose and port is set to 1338:
Although the is port is runing correctly on 1338, it tries to resolve some parts via 1337:
when i set host to 'https://s.example.com' inside server.js, i get
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
4.7.1 is out :-)
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β).
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
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
Hi,
There are lines at the docker-entrypoint file:
docker-strapi/images/strapi-alpine/docker-entrypoint.sh
Lines 25 to 37 in 5b24cf8
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?
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.