Image to run the Strapi CMS in a containerized environment.
docker build -t davidetriso/strapi:[tagname-dir_name] ./[tagname-dir_name]
E.g.:
docker build -t davidetriso/strapi:node-18.18 ./node-18.18
docker push davidetriso/strapi:tagname
E.g.:
docker push davidetriso/strapi:node-18.18
Execute the ./build-and-push.sh
script to build and push all images to Docker Hub at once.
Mount your app code in the /app
dir inside the container using bind mounts; the node_modules
and .next
directories can be excluded, because they will be populated by the image in runtime.
For example, in a compose file add:
volumes:
- ./:/app
# exclude the node_modules and .next directories with 'empty' mounts
- /app/node_modules
- /app/.next
By default the image will start a production server.
To start the application in dev mode, set the ENV
var to dev
.
For example, in a compose file add:
environment:
ENV: dev
NOTE: When the container is launched, and no
package.json
file is found in the/app
directory, the entrypoint script will trigger the creation of a new Strapi application with default configurations. Additionally, it will install the MySQL package as a project dependency.
Licensed under the terms of the MIT license.