Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile lines in definition file #113

Closed
drmrbrewer opened this issue Jan 10, 2018 · 9 comments
Closed

Dockerfile lines in definition file #113

drmrbrewer opened this issue Jan 10, 2018 · 9 comments

Comments

@drmrbrewer
Copy link
Contributor

drmrbrewer commented Jan 10, 2018

Instead of putting the dockerfile lines directly within captain-definition as an array, would it be a nice idea to be able to just have a separate dockerfile, so that we don't have to add double quotes and commas, and escape existing double quotes (which all make it less readable)?

{
  "schemaVersion": 1,
  "dockerfile": "mydockerfile"
}

And then mydockerfile can just be a plain old docker file that can be more easily edited and read?

@githubsaturn
Copy link
Collaborator

It would be misleading. See "Important Note" here: https://github.com/githubsaturn/captainduckduck/wiki/Captain-Definition-File

Captain copies your source file into a src folder whereas if you want to build your dockerfile directly on a machine they are aim to the "current directory". I will have a plan in place to automatically add ./src to the docker files. But before that, it would be confusing to directly point to a dockerfile.

@derek-adair
Copy link

derek-adair commented Oct 3, 2018

I'm willing to help develop this feature in whatever way I can. This seems rather important.

I have a curated set of images that I would LOVE to throw in duckduck and i'm... just... NOT going to convert away from a Dockerfile.

@cooperaj
Copy link

cooperaj commented Dec 7, 2018

Captain copies your source file into a src folder whereas if you want to build your dockerfile directly on a machine they are aim to the "current directory". I will have a plan in place to automatically add ./src to the docker files. But before that, it would be confusing to directly point to a dockerfile.

Surely the solution here (since all my projects build this way) is to just have

{
  "schemaVersion": 1,
  "dockerfile": "src/mydockerfile"
}

Most all my Dockerfiles operate on the basis that they live at the root of my source anyway.

@githubsaturn
Copy link
Collaborator

githubsaturn commented Dec 7, 2018

Just an update on this issue:
It's almost ready. With the release of version v1.0 (early 2019), we will have this feature implemented.

@pedrobracho
Copy link

One question, I have my app ready running with docker-compose, im trying with effort make it run with captainduckduck because im enloved with this project, the problem is that it contious failing on the command captainduckduck deploy.

Right now it says it says

Error: Error: (HTTP code 400) unexpected - No build stage in current context

And im pretty sure because im not sending from dockerfile all lines that i need, specially the one that says

build: .

How can i achive this? with the "tool" porposed on documentation fails also so im trying to write it my own captain-definition file but im lacking the entire knowledge and i can not find a light on internet.

Thaks a lot

@pedrobracho
Copy link

pedrobracho commented Jan 5, 2019

Hi good evening, im trying to convert this docker file:

version: "2"
services:
  mobileappch-api:
    build: .
    command: yarn dev -- -L
    environment:
      - NODE_ENV=development
    volumes:
      - .:/app
    ports:
      - "3000:3000"
    depends_on:
      - mongodb
  mongodb:
    image: mongo
    environment:
      - MONGO_URI=mongodb://mongodb:27017/test
    ports:
      - "27017:27017"

Into a captain-definition file but im lacking experience on this and has been taking me a lot of time and a lot of dead ends.

This is how it goes till now

 {
  "schemaVersion" :1 ,
  "dockerfileLines" :[
                        "RUN yarn dev -- -L",
                        "ENV NODE_ENV dev",
                        "ENV PORT 80",
                        "EXPOSE 80",
                        "CMD [ \"npm\", \"start\" ]"
                    ]
 }

But its incomplete and fails the deployment, any light on this tunnel?

@githubsaturn
Copy link
Collaborator

@pedrobracho
The one that you posted is not a dockerfile, it's a docker-compose file which is a full instruction of one or multiple apps (in your case two apps, a nodejs app and a MongoDB database.)

You must have a Dockerfile inside your directory sitting next to this docker-compose file. Dockerfiles start with FROM imagename line.

Convert your Dockerfile using this tool. Also pay attention to the IMPORTANT NOTE section here about src directory.

@derek-adair
Copy link

@pedrobracho - While i understand why you posted in this thread, you should open a new issue with new questions and reference this issue.

@githubsaturn
Copy link
Collaborator

See https://github.com/caprover/caprover/releases/tag/v1.0.0

captain-definition now accepts dockerfilePath. For example:

{
  "schemaVersion" :2 ,
  "dockerfilePath" :"./myDockerFile"
 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants