#I want to use directus in my project. And we have the requirement to build extensions
25 messages Β· Page 1 of 1 (latest)
A guide on how to scaffold your Directus Extension.
I'd recommend sticking with the docker image
Thanks Tim, So if i use docker image like mentioned below
https://docs.directus.io/self-hosted/installation/docker.html
If I build new extension via (npm init directus-extension) in local
How can i load my local extension in that docker image
How to host Directus on Docker.
by mounting it in a volume π https://docs.directus.io/self-hosted/installation/docker.html#persistence
How to host Directus on Docker.
thanks Tim
Suppose if i am creating directus project via npm for development
In this scenario how to build the base project in my local. Any idea on this?
i have tried 'npm run build'. It is looking for src folder. But if we create via npm we wont have src folder.
In document they have provided run command - npm directus start
**npx ** directus start
i have tried 'npm run build'. It is looking for src folder. But if we create via npm we wont have src folder.
Are you talking about an extension here? you should have a src folder if you've followed the docs
Not about extension.
Instead of using directus docker image
I have created the project using 'npm init directus-project directus' . In this case src folder will not be available in the project structure.
https://docs.directus.io/self-hosted/quickstart.html
So how to build the project that is created via npm ?
If you're looking for the fastest way to get up-and-running with Directus, this guide will walk you through getting things installed, configured, and modeled.
You're right, follow the steps in the docs, npm run build is not mentioned there π
i tried by running - npm run build
My package.json file
"scripts": {
"build": "react-scripts build"
}
Got this error:
Could not find a required file.
Name: index.js
π£
Not sure where that package.json came from but that is not part of Directus π€ We don't use React. Perhaps using docker for local development works better for you π
It looks like you're confusing some different aspects of running directus π i'd recommend doing it 1 step at a time, first setup a directus instance/project, once that works start looking into setting up your extensions.
Yes, for creating the directus project I followed the below link
https://docs.directus.io/self-hosted/quickstart.html
If you're looking for the fastest way to get up-and-running with Directus, this guide will walk you through getting things installed, configured, and modeled.
is this a proper link for setup a new directus project ?
It is π after step 1 you should have a running directus
yes directus is running properly in local π
But, for prod deployment i need to build a docker image from this project
Dockerfile
ARG NODE_VERSION=16-alpine
FROM node:${NODE_VERSION}
WORKDIR /directus
COPY . .
RUN yarn install
EXPOSE 8055
CMD ["yarn", "directus", "start"]
Here i am copying the entire directus project (COPY . .) . Instead of that i need to copy only build folder.
I am facing an issue while building this project in local (command used: npm run build)
Ah no need, a production docker image is provided π https://docs.directus.io/self-hosted/installation/docker.html
How to host Directus on Docker.
you cannot build a docker image from a production npm installation, you'd need to build from source for that
got it π .Thanks Tim for your help
Is this a suggested way?
And since it is open source, if the latest docker image contains any vulnerability. That should be handled manually?
My suggested way is to not bother with NPM and stick with the docker image (build on top of that if need be) π If the latest docker image contains a vulnerability please let us know so we can fix that for everyone instead of manually monkey patching the code (or shoot us a PR at least) π
sure Tim π . Thanks a lot
Hi Tim. You have any sample project for reference (using directus docker image)?