自动构建

这是一个运行于Alpine Linux系统中的简易Git容器,Alpine Linux以其极致精简的特性为基础,使得该容器在保持Git核心功能的同时,具备轻量高效的运行表现,尤其适用于各类小型Linux发行版环境,能够满足资源受限场景下的版本控制需求,为嵌入式系统、边缘设备或轻量级开发环境提供便捷的Git服务支持。

252 次收藏下载次数: 0状态:自动构建维护者:Alpine 工具与轻量镜像仓库类型:镜像最近更新:
下载命令
点击查看

docker-git-alpine

If enjoy, please *** buying me a coffee.

A useful simple git container running in alpine Linux, especially for tiny Linux distro, such as RancherOS, which doesn't have a package manager.

notes about new github action pipeline

From 3rd Oct 2024, the automation build and deploy pipeline has been switched from Circle CI to Github Action (#68 and #70)

notes about multi-arch images

This feature was added on 23th May 2021.

  1. Version v2.30.2 and 1.0.30 are manually pushed by me with multi-arch image supported
  2. Older version will be not updated as multi-arch images
  3. Newer vesions from now on will be multi-arch images (--platform linux/amd64,linux/arm/v7,linux/arm64/v8,linux/arm/v6,linux/ppc64le,linux/s390x,linux/386)
  4. I don't support other architectures, except amd64, because I have no other environment to do that. If you have any issues with other arch, you need raise PR to fix it.
  5. There would be no difference for docker pull , docker run command with other arch, you can run it as normal. For example, if you need pull image from arm (such as new Mac M1 chip), you can run docker pull alpine/git:v2.30.2 to get the image directly.

Github Repo

https://github.com/alpine-docker/git

CI build logs

https://github.com/alpine-docker/git/actions

Docker image tags

https://hub.docker.com/r/alpine/git/tags/

Usage

docker run -ti --rm -v ${HOME}:/root -v $(pwd):/git alpine/git <git_command>

For example, if you need clone this repository, you can run

docker run -ti --rm -v ${HOME}:/root -v $(pwd):/git alpine/git clone https://github.com/alpine-docker/git.git

Optional usage 1:

To save your type, add this fuction to ~/.bashrc or ~/.profile

$ cat ~/.profile

...

function git () {
    (docker run -ti --rm -v ${HOME}:/root -v $(pwd):/git alpine/git "$@")
}

...

$ source ~/.profile

for example, if you need clone this repository, with the function you just set, you can run it as local command

git clone https://github.com/alpine-docker/git.git

Optional usage 2:

alias git="docker run -ti --rm -v $(pwd):/git -v $HOME/.ssh:/root/.ssh alpine/git"

NOTES:

  • You need redefine (re-run) the alias, when you switch between different repositories
  • You need run above alias command only under git repository's root directory.

Optional usage 3:

alias git='docker run -ti --rm -u$(id -u):$(id -g) -e HOME=${HOME} -v /etc/passwd:/etc/passwd -v /etc/group:/etc/group -v ${HOME}:${HOME} -v $(pwd):/git alpine/git'

NOTES:

  • set uid:gid and provide passwd and group from host
  • run git as the current user instead of root for proper ownership of files
  • can be used at any directory as evaluation of $(pwd) is defered until alias is used

Demo

$ cd application
$ alias git="docker run -ti --rm -v $(pwd):/git -v $HOME/.ssh:/root/.ssh alpine/git"
$ git clone ***:YOUR_ACCOUNT/YOUR_REPO.git
$ cd YOUR_REPO
$ alias git="docker run -ti --rm -v $(pwd):/git -v $HOME/.ssh:/root/.ssh alpine/git"
# edit several files
$ git add . 
$ git status
$ git commit -m "test"
$ git push -u origin master

The Protocols

Supports git, http/https and ssh protocols.

Refer: https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols

Automation builds

Set CI to run builds per week

  • build latest alpine image with multi-arch supported
  • Get the git version from the image
  • use the git's version as image tag as well (v${GIT_VERSION})
  • update latest tag for this image

镜像拉取方式

您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。

轩辕镜像加速拉取命令点我查看更多 git 镜像标签

docker pull docker.xuanyuan.run/alpine/git:<标签>

DockerHub 原生拉取命令

docker pull alpine/git:<标签>
专业版 · 高速稳定拉取镜像
50GB 仅 ¥8/年
高速镜像下载在线技术支持专业版保障服务可用付费会员免广告