Skip to content

miebach/ungit-docker

 
 

Repository files navigation

ungit-docker

Simple docker setup for ungit - https://github.com/FredrikNoren/ungit

Github: https://github.com/miebach/ungit-docker

Security implications

  1. You should most propbably set a password in the .ungitrc file

  2. Maybe set the interface to localhost only, see .ungitrc

  3. Consider https by putting it behind a reverse proxy

  4. In both setups the current user's ./.ssh/ directory is mounted into the container, but this also contains the private keys. This could be improved.

Certificate handling

When connecting to git remotes for the first time, keep an eye on the terminal, there might be certificate questions to answer. This is still unsolved for the docker-compose setup. A workaround is to use git on the command line once, after that ungit should not complain anymore.

Starting

Docker compose

Copy dot-env-example to .env and set LOCALREPOBASE to your base folder for local repositories. See explanation below.

docker compose up

Then go to http://127.0.0.1:8448 or use the public IP of your docker host.

Docker

You can create a start script similar to this:

#!/bin/bash
LOCALREPOBASE=$HOME/myprojects # set to your base folder for local repositories

docker run -it --rm \
  -p 8448:8448 \
  -v $HOME/.ungitrc:/home/node/.ungitrc \
  -v $HOME/.ssh:/home/node/.ssh \
  -v $HOME/.gitconfig:/home/node/.gitconfig \
  -v $LOCALREPOBASE:/data \
  miebach/ungit

Configuration

A .ungitrc configuration could look like this, remember to replace the password:

{
    "port": 8448,
    "bugtracking": false,
    "autoFetch": false,
    "ungitBindIp": "0.0.0.0",
    "launchBrowser": false,
    "authentication": true,
    "users": {
      "admin": "replace-password-here"
    }
}

If you don"t want to provide a .ungitrc you can omit the -V line and a .ungitrc from the container will be used, but it allows access without login if that is what you want.

Adjust all variables before running ungit

Configure local repository base directory

To construct a path for ungit, you need to replace your local repository base directory from above with /data/ in the ungit gui in your browser. Example:

If you want to open your local repository /home/myaccount/myprojects/project1 you set $LOCALREPOBASE to /home/myaccount/myprojects you need to enter /data/project1 in the ungit gui in your browser.

Global git config

You can set your user data globally, the global git configuration is visible to the container.

Credits

Started as a fork of https://github.com/mcrmonkey/ungit See also https://github.com/lsascha/ungit

Packages

No packages published

Languages

  • Dockerfile 100.0%