Tuesday, November 8, 2016

Setting up Jenkins with git-lfs support on ubuntu

I couldn't find an exact "how-to" build a Jenkins docker instance with git-lfs support, so I thought I'd post my solution:

  • Create a "Dockerfile"
  • Add the following to the Dockerfile:

    FROM jenkins
    # if we want to install via apt
    USER root
    RUN build_deps="curl ca-certificates" && \
        apt-get update && \
        DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ${build_deps} && \
        curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \
        DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends git-lfs && \
        git lfs install ;
    USER jenkins
    
    
    
  • Issue the following command from the same directory that contains the "Dockerfile" file:

    sudo docker build --no-cache -t jenkins .


  • The Docker instance should build, to run, issue the following:

    sudo docker run -d --name jenkins -p 8080:8080 -p 50000:50000 -v /home/ubuntu:/var/jenkins_home jenkins
    

    /home/ubuntu in this case is my systems home directory - you will want to set to wherever you want Jenkins to store all of it's settings and workspaces