Sign inSign up

insight4upublic/git

By insight4upublic

•Updated about 1 year ago

small devcontainer with git & docker cli

Image
Languages & frameworks
Integration & delivery
API management
0

427

insight4upublic/git repository overview

⁠docker-git

Minimal Ubuntu 22.04 sandbox container with git functionalities, with some simplified commands.
Functionality: minimal container with vim & git to work on docker images.
Use at own risk, as the username/pass are somewhat exposed in a credentials file.

Insight4U Docker Pulls Docker Image Size Github stars Github last-commit Github commits Github issues Github open issues

⁠setup
  • At first start of the container, a credentials file will be created in your volume mounted to container path /mnt/repos
    The container will be automatically stopped.

  • Complete the ".credentials.txt" file
    No spaces
    If there are symbols like $ in your user and/or pass, use single quotes.

  • Restart the container

  • Run the docker container and the generated ssh key will be in the docker log.

    docker logs -f git

  • add this to your github.com account via Settings -> SSH and GPG keys

Now you can connect to the container:

docker exec -it git /bin/bash

and use commands gitpush & dockerpush
First, clone your git repository and edit/modify

    git clone https://github.com/yourgituser/yourgitrepo
    cd yourgitrepo

To enable large file storage:

    git lfs install
    git lfs track yourfolder/yourfileprefix*.extension
    git add .gitattributes

To use 1 command to push to git:

gitpush [comment] [tag]

e.g.

    gitpush
    gitpush "upgraded python" 1.3	
    gitpush "adapted the README.md" main

Create your docker repository on the docker hub.
After that you can build + push from this container

dockerpush <repository>[:tag]

e.g.

    dockerpush yourdockerrepo
    dockerpush yourdockerrepo:1.0
    dockerpush yourdockerrepo:1.1 --purge-images

Or do it all at once with push

push <docker-repository>[:docker-tag]

e.g.

push yourdockerrepo:1.0
⁠environment variables
Environment VariableKeyDescription
TZEurope/Brusselstimezone for ntpdate
⁠credentials.txt file will contain the following variables (do not add spaces!)
.credentials.txt variableDescription
GITUSERyour github username / repository name
GITMAILyour github email / signin account
DOCKERUSERyour docker user account
DOCKERPASSyour docker password
SSHPASSopenssh-server password
⁠volumes
VolumeContainer path
/host/folder/with/repos/mnt/github
/var/run/docker.sock/var/run/docker.sock
⁠ports

Optionally exposed ssh port

Host portContainer port
123422
⁠Run command
docker run -d --name='git' \
--net='bridge' \
-e TZ="Europe/Paris" \
-v '/path/on/host/':'/mnt/github':'rw' \
-v '/var/run/docker.sock':'/var/run/docker.sock':'rw' \
'insight4upublic/git'

github repo: https://github.com/Dedalus-Insight4U/docker-git⁠
dockerhub repo: https://hub.docker.com/repository/docker/insight4upublic/git⁠

⁠log

log arrives in /var/log/git.log.
README.md will be updated on the docker hub using peterevans/dockerhub-description, so a shoutout to him!

Tag summary

Content type

Image

Digest

sha256:6fd50a621…

Size

332.6 MB

Last updated

about 1 year ago

docker pull insight4upublic/git