Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a Docker Image for a Github Project

I have a GitHub project, (that I am working with (I didn't create it)), called OpenRefine, which I would like to encapsulate in a Docker image, such that other people can then pull that Docker image from the "Docker Hub" and have OpenRefine installed on their fundamental interactive Docker entity, viz. Image.

I want to then upload it to a repository that I can share with others.

It would be good if it had a name and not a crazy hash value.


Is it that I just create a "docker file" a text files with a git clone command?

but then how to upload that to a repository such as the docker hub? I just put that text file there?

Something like

FROM ubuntu

MAINTAINER :/ WTF?!

RUN git clone blah

CMD what here?

enter image description here


This seems like a very basic issue but the information is not readily accessible in the Docker provided tutorials, nor is there a definitive answer on Stackoverflow, but those are indisputably excellent resources for a very complicated way to make a terminal output "Hello World".

like image 295
smatthewenglish Avatar asked Aug 24 '15 19:08

smatthewenglish


3 Answers

While Sergius' answer isn't wrong, additional ways to do this would be through a Dockerfile https://docs.docker.com/reference/builder/. This way you can either include a Dockerfile in your github project and build that image to put up on docker hub. Or you can create a dockerfile that pulls your project from github, runs any necessary build steps and then push that to docker hub.

In either ways you would need to build the image from the dockerfile with

docker build -t <name of image> <OPTIONS> <build context>

and then you would use docker push to push the image.

For a Dockerfile outside of your project:

FROM ubuntu:14.04
RUN apt-get install git && \
git clone <your git repo> && \
<additional bash commands for building your project>
CMD <command to run your project> # Can also use ENTRYPOINT in certain cases
like image 196
Christian Grabowski Avatar answered Oct 18 '22 01:10

Christian Grabowski


I'm not sure, but you can try to fetch some basic docker image, which is suitable to run your application. Build your application there and use "docker commit" to get new image, which will contain that basic image with your application.

like image 2
Sergius Avatar answered Oct 18 '22 01:10

Sergius


There are already plenty of Docker images for OpenRefine hosted on the Docker Hub.

Why don't you take example on one of their Dockerfile? This one seems to be the most popular.

like image 1
Thomasleveil Avatar answered Oct 18 '22 00:10

Thomasleveil