One possible solution might be to use the node:17-alpine Docker image instead as your base image… since the alpine based image is usually significantly smaller than the Debian based version this should reduce your final image size… keep in mind though that you have to use apk instead of apt to install any required dependencies.
The reason is that Strapi is designed to be installed locally and deployed to production with your own configuration files. As a result, we recommend using the Dockerfile described in the video but build your own Docker image (dedicated to your Strapi project).
Huge credits to Simen!
Thank you @mattias
docker image success , thank you.
Can I create Database in Docker Image after loading it to the cloud? add plugins ? or even customize it?
Hi, good video and blog post. I'm missing one thing - what about image/media files uploaded in strapi?
If you want to do that you need to use an external provider. Or bind mount a folder on the server to the container.
Hope it helps.
@@Eventyret yeah exactly what I had in mind, but wanted to confirm.
Thanks!
If you run into this error: error docker-strapi-tutorial@0.1.0: The engine "node" is incompatible with this module. Expected version ">=18.0.0
Thank you.
The link to the uick start quide is malformated. so there shows up a 404
Any ideas how to reduce the image size? 2.7Gb is quite large
One possible solution might be to use the node:17-alpine Docker image instead as your base image… since the alpine based image is usually significantly smaller than the Debian based version this should reduce your final image size… keep in mind though that you have to use apk instead of apt to install any required dependencies.
=> ERROR [ 4/10] COPY ./package.json ./yarn.lock ./
getting this error
what shoud I do ?
Thank you sir.
why don't you guys have strapi v4 official docker image already when it's most asked feature on votepage?
The reason is that Strapi is designed to be installed locally and deployed to production with your own configuration files. As a result, we recommend using the Dockerfile described in the video but build your own Docker image (dedicated to your Strapi project).
@@pierreburgy7442configuration should be passed in. I don't want to bake config into every containter i run.
why not use docker-compose?
Why not Kubernetes ? 😂
version: '3.7'
services:
postgres:
container_name: postgres_container
image: postgres:12
restart: always
environment:
POSTGRES_DB: strapi
POSTGRES_USER: strapi
POSTGRES_PASSWORD: strapi
volumes:
- postgres-data:/var/lib/postgresql/data
ports:
- '5433:5432'
networks:
- your-network
strapi:
container_name: strapi_container
image: strapi/strapi
restart: always
environment:
DATABASE_CLIENT: postgres
DATABASE_NAME: strapi
DATABASE_HOST: postgres
DATABASE_PORT: 5432
DATABASE_USERNAME: strapi
DATABASE_PASSWORD: strapi
volumes:
- ./app:/srv/app
ports:
- '1337:1337'
networks:
- your-network
depends_on:
- postgres
pgadmin:
container_name: pgadmin_container
image: dpage/pgadmin4
environment:
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-your@email.com}
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-your-password}
volumes:
- pgadmin:/root/.pgadmin
ports:
- "${PGADMIN_PORT:-5050}:80"
networks:
- your-network
restart: unless-stopped
networks:
your-network:
driver: bridge
volumes:
postgres-data:
pgadmin:
The written guide has a docker-compose i believe or the Heroku guide I wrote has it atleast.
Which VS Code theme is this?
It may be "Atom One Light Theme".
With npm throwing build error