Coder Social home page Coder Social logo

docker-gogs's Introduction

Build Status

Gogs

A production optimised version of Gogs, able to run in --read-only mode. The only caveat is that you need to mount the s6 volume (to make it writable) as s6 will need to do some writing.

Other services that run on the image:

  • crond
  • ssh (port 22222)

Running in read-only mode

Runs using a user git:801, so there are a number of options for running the container...

  1. Create a host user with matching UID:

sudo useradd --no-create-home --system --shell /bin/false --uid 801 foo

docker run \
    --name gogs \
    --rm \
    --read-only \
    --tmpfs /tmp:rw,size=100000k \
    -v /var/gogs/config:/config:ro \
    -v /var/gogs/data:/data \
    -v /var/gogs/s6:/var/run/s6 \
    -p 127.0.0.1:22:22222 \
    -p 127.0.0.1:3000:3000 \
    --cpus=".3" \
    --memory="250m" \
    --pids-limit 50 \
    --security-opt="no-new-privileges:true" \
    --health-cmd="curl --fail http://localhost:3000/healthcheck || exit 1" \
    --health-interval=5s \
    --health-retries=3 \
    robertbeal/gogs
  1. Mount /etc/passwd and create a host user with matching name:

sudo useradd --no-create-home --system --shell /bin/false git

docker run \
    --name gogs \
    --rm \
    --read-only \
    --tmpfs /tmp:rw,size=100000k \
    -v /etc/passwd:/etc/passwd:ro \
    -v /var/gogs/config:/config:ro \
    -v /var/gogs/data:/data \
    -v /var/gogs/s6:/var/run/s6 \
    -p 127.0.0.1:22:22222 \
    -p 127.0.0.1:3000:3000 \
    --cpus=".3" \
    --memory="250m" \
    --pids-limit 50 \
    --security-opt="no-new-privileges:true" \
    --health-cmd="curl --fail http://localhost:3000/healthcheck || exit 1" \
    --health-interval=5s \
    --health-retries=3 \
    robertbeal/gogs

Running in writable mode

It is possible to define a UID and GID to the container but --read-only won't be possible as it modifies /etc/passwd. This is done using usermod (via the shadow package in alpine):

docker run \
    --name gogs \
    --rm \
    -e UID=$(id -u) \
    -e GID=$(id -g) \
    -v /var/gogs/config:/config:ro \
    -v /var/gogs/data:/data \
    -p 127.0.0.1:22:22222 \
    -p 127.0.0.1:3000:3000 \
    --cpus=".3" \
    --memory="250m" \
    --pids-limit 50 \
    --health-cmd="curl --fail http://localhost:3000/healthcheck || exit 1" \
    --health-interval=5s \
    --health-retries=3 \
    robertbeal/gogs

Set your own UID/GID during build

As a final option, should you wish, you can specify your own UID and GID for the git user when building the image.

docker build \
    --build-arg=UID=1234 \
    --build-arg=GID=5678 \
    -t gogs .

docker-gogs's People

Contributors

robertbeal avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.