Reputation: 133
I have this image:
FROM ubuntu:14.04.3
# copy db project to container
ADD . /db_project
WORKDIR /db_project
CMD ["./gitinitall.sh"]
This will copy the content of the current dir with db project that it contains git submodules which will be checked out and pulled from repo. So in db_project is the shell script that I run to get the submodules. Also has the backend that uses the dbs. The image is pushed to a private repo.
I want to use this image to create a container where I need to add the config of the database for the environment where it needs to be deployed, something like:
FROM myprivatedockerrepo:5000/db_project
...
WORKDIR /db_project
COPY config/dev.config /db_project/apps/mydb_db/config/dev.config
# get everything needed for backend
RUN mix deps.get
# expose the backend port
EXPOSE backendport
# start the beckend with the proper db configured
CMD ["./startbeckend"]
But it is failing to RUN mix deps.get:
Step 14/20 : RUN mix deps.get
---> Running in ab7375d69989
warning: path "apps/mydb_db" is a directory but it has no mix.exs. Mix won't consider this directory as part of your umbrella application. Please add a "mix.exs" or set the ":apps" key in your umbrella configuration with all relevant apps names as atoms
If I add a
RUN ls apps/mydb_db
before running the mix command:
ls: cannot access apps/mydb_db: No such file or directory
So it seems although in the image used, myprivatedockerrepo:5000/db_project, there should be db_project/apps/mydb_db - mydb_db created by the shell script submodule get from git, it cannot find it, maybe I do not understand the docker layers or something?
Upvotes: 1
Views: 740
Reputation: 133
Was my bad, the gitinitall.sh script to get and update all submodules from git didn't work, since had no git settings or ssh key in the image, but it didn't return any code so it shows no failure.
Upvotes: 0
Reputation: 3704
To copy a folder you need to add a final '/'
# Dockerfile ADD . /db_project/
See also here: https://docs.docker.com/engine/reference/builder/#add
Upvotes: 1