How to add a git clone command in Dockerfile - django

I would like to clone a GitHub repo through my requirements.txt in Docker.
Actually the requirements file contains :
-e git://github.com/USERNAME/REPO.git
Django==1.11.8
....
what is the specific command that I should add in Dockerfile to execute correctly the git clone command.
I tried RUN git clone git#github.com:USERNAME/REPO.git without any success.
Any suggestions ?

I found a solution,
I simply modify my code from
-e git://github.com/USERNAME/REPO.git to
git+https://github.com/USERNAME/REPO.git and it works great.

Related

Git clone issue into specific folder

I have an issue with cloning private repository into my instance(ec2: CentOS 7).
I've generated the key and added it to github.
The problem is when I'm trying to clone it into /home/app directory (Permission denied (publickey)...), but when I run the same command in /home/ec2-user/app it works fine.
Looks like a permissions issue.
My command:
sudo git clone git#github.com:.../my_website.git
Would be appreciate for any advise
I solved it by running:
sudo chmod 777 app
But I don't think it's a perfect solution

git: 'remote-https' is not a git command. See 'git --help'

I have been trying to clone my repository and it shows the following error:-
git: 'remote-https' is not a git command. See 'git --help'
Here is my:-
Clone from
https://github.com/NavyaThakur/django-project1
To directory
C:\Users\91933\github\django-project1
I tried reinstalling github desktop but no use.
Please help me through this
Try git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
so for you git clone https://github.com/NavyaThakur/django-project1
Git Clone Documentation
This error means your git executable was not built with ssl and/or libcurl.
From experience this seems to be a problem on some RedHat based distributions.
If you have admin access just make use you install the correct git client. If not you will have to build git yourself or install from a repository into your user account (both of which are not trivial, sorry)

Modify python file which was installed using pip inside an Docker image

I installed a python module called requests-aws4auth in docker using RUN pip install requests-aws4auth
Now I want to modify it by going into cd /opt/conda/lib/python2.7/site-packages/requests_aws4auth/ and commenting a line in aws4auth.py file. I already installed vim while building the docker.
Is it possible to do this while building the dockerfile? If yes, then can some one help me out.
I could do it by using sudo docker run -i -t image_name /bin/bash and modifying the file, but this will create a container. Now, is there any way to push the container back to the image.
There are two ways to do this:
Add some sed command that comments the line in the file after pip install command in dockerfile something like this -
RUN pip install requests-aws4auth
RUN sed -e '/BBB/ s/^#*/#/' -i file #some logic to comment the line
Build the docker image and use it.
If option-1 didn't seems to help try committing the container.
docker run the container do docker exec and comment the line in file. Now commit the container docker commit <conatainer-id> <some custom image name> https://docs.docker.com/engine/reference/commandline/commit/
Now use this custom image.

Installing an old version of Foundation

Is there any way to easily install a Foundation version, other that the latest one? Instructions for "manual" install start with
git clone https://github.com/zurb/foundation-sites-template projectname
Ideally, I'd like to be able to do something like
git clone https://github.com/zurb/foundation-sites-template/tree/v6.1.2 projectname
but there is no such v6.1.2 tag
EDIT:
I have found a workaround - I run
git clone https://github.com/zurb/foundation-sites-template projectname
And then I edit the dependencies in bower.json and proceed with the rest of the installation. At least it works for my purposes, as I mainly need the scss stuff, not the whole project. And I still have to hunt for the correct versions of scss/app.scss and scss/_settings.scss as the ones getting downloaded are for the latest version.
Would be nice if there was a fully automated way of installing a version other than the latest.
There is actualy NO TAG for the Zurb-Foundation TEMPLATE project on github (https://github.com/zurb/foundation-sites-template):
Maybe you could switch to the actual Site project if it is what you are looking for.
EDIT:
I suggest making a ps1 or .bat script that would do the following
git clone https://github.com/zurb/foundation-zurb-template projectname
cd projectname
cp C://bower.json bower.json -f
npm install
bower install
You could also fork the template project on Github and edit it's bower.json so it's always up to date and there is no need to use the cp command
Or make a git repo of the variables you are using and do something like
git clone https://github.com/zurb/foundation-zurb-template projectname
git clone https://github.com/you/foundation-version foundation-version
cd projectname
cp ../foundation-version/bower.json bower.json -f
npm install
bower install

Docker Hub automated build failure. Local build is fine

I've created a dockerfile to take an official php/apache image, add a bunch of dependencies and clone a GitHub repo, which works great when building a container image locally, but fails when I push it to GitHub and trigger an automated build at Docker Hub.
The command which fails is the git clone
RUN git clone git://github.com/symphonycms/symphony-2.git /var/www/html
and the reason for failure (according to Git) is
Step 5 : RUN git clone git://github.com/symphonycms/symphony-2.git
/var/www/html && git checkout --track origin/bundle && git
submodule update --init --recursive && git clone
git://github.com/symphonycms/workspace.git && chown -R
www-data:www-data *
[91mfatal: destination path '/var/www/html'
already exists and is not an empty directory.
Can someone explain why there is no problem building locally but a failure at the hub?
So the image that you are pushing has the /var/www/html/ directory in it (and probably has the git repo in it).
Try this in your docker file to make sure the directory doesn't exist:
RUN rm -rf /var/www/html
RUN git clone git://github.com/symphonycms/symphony-2.git /var/www/html && git checkout --track origin/bundle && git submodule update --init --recursive && git clone git://github.com/symphonycms/workspace.git && chown -R www-data:www-data