When deploying Parse server from a Docker container, how do you install other adapters? Or check if they are installed already?
Specifically, I am looking at the SendGrid email adapter. I am using Parse v4 with Docker Compose to deploy to a local machine (while in dev).
You can do this by editing the package.json file to include dependencies (here I use the fs-server-adapter):
{
"name": "parse-server",
"version": "1.0.0",
"description": "parse-server",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/parse-server"
},
"license": "MIT",
"dependencies": {
"express": "^4.17.1",
"parse-server": "4.1.0",
"@parse/fs-files-adapter": "*"
},
"scripts": {
"start": "node index.js"
},
"engines": {
"node": ">= 8"
}
}
In your docker file, the package will be installed during npm install
.
You can then access your installed adapter in your custom index.js
Below is my Dockerfile:
FROM node:lts-alpine
RUN mkdir parse
ADD ./package.json ./index.js /parse/
WORKDIR /parse
RUN npm install
EXPOSE ${PORT}
CMD [ "npm", "start" ]
If you need an example of how I setup the index.js files in other with docker, I have an example here: https://github.com/netreconlab/parse-postgres
I don’t suppose you have any experience of the Bitnami configured containers? I wonder if they have changed the structure / config, or which files to edit.
In my container, there are files at:
I’ve seen some of the bitnami containers, but I don’t use them. I know they place files in custom directories like the ones you listed above. It seems if you replace those files and build you should get the end result you are looking for.
MeIr
August 3, 2021, 1:26pm
5
Thank you! Helped a lot.
I made a shortcut:
FROM parseplatform/parse-server
USER root
RUN npm i parse-smtp-template
USER node
Seems to be working ok