Captain Definition File
Basics
One of the key components of CaptainDuckDuck is the captain-definition file that sits at the root of your project. In case of NodeJS app, it sits next to package.json, or next to index.php in case of PHP, or requirements.txt for Python app. It's a simple JSON like below:
{
"schemaVersion" :1 ,
"templateId" :"node/8.7.0"
}
schemaVersion is always 1. And templateId is the piece which defines the what sort of base you need in order to run your app. It is in LANGUAGE/VERSION format. LANGUAGE can be one of these: node, php, python-django, ruby-rack. See supported versions below for the versions.
Note that although the current version of CaptainDuckDuck comes with 4 most popular web app languages: NodeJS, PHP and Python/Django, Ruby/Rack. It gives you the advanced option of defining your own Dockerfile. With a customized Dockerfile, you can deploy any laguage, Go, Java, .NET, you name it! Dockerfiles are quite easy to write. For example, the two captain-definition files below generate the exact same result.
Simple version
{
"schemaVersion" :1 ,
"templateId" :"node/8.7.0"
}
Advanced Version
{
"schemaVersion" :1 ,
"dockerfileLines" :[
"FROM node:8.7.0-alpine",
"RUN mkdir -p /usr/src/app",
"WORKDIR /usr/src/app",
"COPY ./src/package.json /usr/src/app/",
"RUN npm install && npm cache clean --force",
"COPY ./src /usr/src/app",
"ENV NODE_ENV production",
"ENV PORT 80",
"EXPOSE 80",
"CMD [ \"npm\", \"start\" ]"
]
}
Convert Dockerfile to captain-definition:
You can use this tool to convert your Dockerfile to captain-definition file easily. This NodeJS script is also for the same purpose, except, it automatically adds .src/ to the COPY lines.
Even if you don't know anything about Docker, you can get an idea what this does. Some examples of advanced methods: PHP Composer and Meteor
IMPORANT NOTE:
Captain generates a dockerfile and puts it besides a directory named src where your source code sits. So if in your normal dockerfile, you have COPY ./somefile /usr/app, you will have to change it to COPY ./src/somefile /usr/app otherwise deploy would fail.
Using this approach you can deploy Ruby, Java, Scala, literally everything! If you need more details on dockerfile, please see Dockerfile Help and Best Practices.
Supported versions for simple version:
NOTE: Versions get pulled from official repositories at runtime, therefore you do not need to update your Captain in order to use a new version of NodeJS. For example, see here: https://hub.docker.com/_/node/
node/
carbon, 8, 8.9, 8.9.4, boron, 6, 6.12, 6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