Docker image for strapi version 5 (latest version)
API creation made simple, secure and fast. The most advanced open-source Content Management Framework to build powerful API with no effort.
Using Docker Compose, create docker-compose.yml file with the following content:
version: "3"
services:
strapi:
image: bibolorean/strapi
environment:
NODE_ENV: development # or production
ports:
- "1337:1337"
# volumes:
# - ./app:/srv/app # mount an existing strapi projector using Docker:
docker run -d -p 1337:1337 bibolorean/strapi --env NODE_ENV=developmentThis image allows you to create a new strapi project or run an existing strapi project.
- for
$NODE_ENV = development: The command that will run in your project isstrapi develop. - for
$NODE_ENV = production: The command that will run in your project isstrapi start.
The Content-Type Builder plugin is disabled WHEN
$NODE_ENV = production.
When running this image, strapi will check if there is a project in the /srv/app folder of the container. If there is
nothing then it will run
the create-strapi
command in the container /srv/app folder.
This command creates a project with an SQLite database. Then starts it on port 1337.
Environment variables
When creating a new project with this image you can pass database configurations to
the create-strapi
command.
DATABASE_CLIENTa database provider supported by Strapi: (sqlite, postgres, mysql ,mongo).DATABASE_HOSTdatabase host.DATABASE_PORTdatabase port.DATABASE_NAMEdatabase name.DATABASE_USERNAMEdatabase username.DATABASE_PASSWORDdatabase password.DATABASE_SSLboolean for SSL.EXTRA_ARGSpass extra args to thecreate-strapi.
To run an existing project, you can mount the project folder in the container at /srv/app.
-
The official documentation of strapi is available on https://docs.strapi.io/.
-
The official strapi docker image is available on GitHub (not yet upgraded to v4).
