Strapi containerized with setup
A quick test on dockerized Strapi app, with the following additional setup:
- Add
traefixfor reverse-proxying - Use SQLite for the default database as in Quick Start)
- Execute shell scripts for scaffolding:
- Use a custom
public/index.html - Install
graphqlplugin. - Generate API for content types
postandcomment.
- Use a custom
The following files are adopted from the official "strapi/strapi-docker" repo with changes if relevant:
docker-compose.yml,mongo.docker-compose.ymlDockerfile,mongo.Dockerfilehealthcheck.jsstrapi.sh,mongo/strapi.sh
- Clone this repo
git clone https://github.com/bobaekang/strapi-docker-with-setup.git
cd strapi-docker-with-setup- Bring up the docker-compose (Add
-dflag is for detached mode) This will build thetest/strapi-dockerimage as well.
docker-compose upIf you want to use Mongo for database as in the official Strapi containerized repo, use the following command instead:
docker-compose -f docker-compose.yml -f mongo.docker-compose.yml upThis will combine both Docker Compose files into a single configuration and build the test/strapi-docker-mongo image. Refer to this page of the Docker documentation for more on combining Compose files.
-
Open
localhost:1337in a browser and see if the app is running. (It might take some time.) -
Go to
localhost:1337/adminand create the root admin account. -
Run
strapi-scaffold.shin the container.
# add "winpty" before the command for Windows
docker exec -it strapi-docker-with-setup_api_1 ./strapi-scaffold.sh- Run
docker-compose restart apito restart Starpi and make new content types available.
That's it!:raised_hands: Now you have a Strapi server running in container with some custom setup.
Feel free to fork this repo and edit files/scripts to further customize it.