Hello,
I just started using captainduckduck and I can't be more helpful for this!
But I have one simple problem with it: I can't have CLI deploys when using monolithic (client + server) project.
Let's say I have a git repository that contains /client and /server
I want to deploy /server using captain duckduck, but when I simply cd server && captainduckduck deploy I get error **** ERROR: You are not in a git root directory. This command will only deploys the current directory ****
Is there any workaround to this? If not, could you consider adding this option to captainduckduck? (something like "projectDirectory": "/server" in captain-definition)
Thanks!
Sure there is. You can simply change the default Dockerfile so that it only copies your /server directory to the Docker image. For example, in case of a NodeJS application, use the following as your captain-definition file:
{
"schemaVersion": 1,
"dockerfileLines": [
"FROM node:8.7.0-alpine",
"RUN mkdir -p /usr/src/app",
"WORKDIR /usr/src/app",
"COPY ./src/server/package.json /usr/src/app/",
"RUN npm install && npm cache clean --force",
"COPY ./src/server /usr/src/app",
"ENV NODE_ENV production",
"ENV PORT 80",
"EXPOSE 80",
"CMD [ \"npm\", \"start\" ]"
]
}
Notice how I replaced ./src (default) with ./src/server in both COPY lines.
Hi, we're also facing this issue and not sure how this comment resolves this issue. To be clear, we want to run the CLI from the project/web directory, and we have a separate project/bot directory that is also a separate captain application. We want to be able to deploy either from their respective directories. Is this possible?
Captain uses git to convert your repo into a tar file to send it to the server. That's why monolithic repos don't play well. However, we have added an option to create and specify the tar file during deployment. With this new option, it is possible to deploy two different apps from the same repo. In order for this to work,
captain-definition files, one inside web, one inside bot directorytar -cvf ./deploy.tar ./web/*
This command converts the content of web directory into a tar file deploy.tar. Then you run
captainduckduck deploy -t ./deploy.tar
This is the same approach people use to pre-build their applications on the local machine before sending it to server: https://caprover.com/docs/recipe-deploy-create-react-app.html
Thank you very much!