Gogs is a painless self-hosted Git Service written in Go. It aims to make the easiest, fastest and most painless way to set up a self-hosted Git service. With Go, this can be done in independent binary distribution across ALL platforms that Go supports, including Linux, Mac OS X, and Windows.

Deploying Gogs in a container

The deployment of Gogs is straight forward, just run the gogs-compose.yaml, local or on a swarm cluster and you are done. It’s like having a github or gitlabs running localy, you could even expose the container (via a proxy) to the internet.

# file: gogs.yaml
version: '3'

services:
  gogs:
    networks:
      - gogs-net
    restart: unless-stopped
    image: gogs/gogs
    volumes:
      - /opt/docker/gogs/volumes/data:/data
    ports:
      - 10022:22
      - 13000:3000

networks:
  gogs-net:
  

Deploying the stack in docker swarm is just one command, if you are running portainer go to stacks, add stack and past the code above in the stack text field.

  docker stack deploy -c gogs.yaml gitserver