Closed hodanli closed 1 year ago
Hi @hodanli, these are my steps for working with docker:
Instead of using the official directus-image directly, we will build our own custom image that's extending the official image.
Own repository with Dockerfile, docker-compose.yml and a valid searchsync-config-file. Take a look at my demo
module.exports = {
server: {
type: 'meilisearch',
host: 'http://host.docker.internal:7700',
key: '<your-api-key>',
},
reindexOnStart: true,
collections: {
test_collection: {
fields: ['title', 'description'],
},
},
}
FROM directus/directus:9.23.1
# Install git
# We need this part becaus "npm install" will fail without the git package.
# Installing apk packages needs permissions, so we need to switch to root user.
USER root
RUN apk add git --no-cache
# SearchSync extension
# First we copy the config file, then we install the extension.
COPY searchsync.config.cjs ./
RUN npm install dimitrov-adrian/directus-extension-searchsync
# Start command for our image
CMD npx directus bootstrap && \
npx directus database migrate:latest && \
npx directus start
[...]
services:
[...]
custom-directus:
container_name: custom-directus
# build the image from the Dockerfile in the current directory
# ---
build:
context: ./
dockerfile: Dockerfile
# ---
[...]
considering npm install is not recommended for production. i was expecting much simpler solution. but thanks, i will try this.
considering npm install is not recommended for production.
Ok, didn't know that so far. Why is that the case?
What's the difference between:
In any way, you have to install your packages first, before you can run/build your software. Am I missing something?
it says at the top of this documentation page:
how can i install this extension to directus docker container?