Browse Source

added docker-compose config

Fabian Peter Hammerle 3 years ago
parent
commit
ef3ffbecc4
2 changed files with 31 additions and 2 deletions
  1. 2 2
      Dockerfile
  2. 29 0
      docker-compose.yml

+ 2 - 2
Dockerfile

@@ -4,6 +4,7 @@ ARG GITOLITE_PACKAGE_VERSION=3.6.11-2
 ARG GIT_ANNEX_PACKAGE_VERSION=7.20190129-3
 ARG GIT_PACKAGE_VERSION=1:2.20.1-2+deb10u3
 ARG OPENSSH_SERVER_PACKAGE_VERSION=1:7.9p1-10+deb10u2
+ARG TINI_PACKAGE_VERSION=0.18.0-1
 ARG USER=git
 ARG GITOLITE_HOME_PATH=/var/lib/gitolite
 ENV SSHD_HOST_KEYS_DIR=/etc/ssh/host_keys
@@ -13,6 +14,7 @@ RUN apt-get update \
         git=$GIT_PACKAGE_VERSION \
         gitolite3=$GITOLITE_PACKAGE_VERSION \
         openssh-server=$OPENSSH_SERVER_PACKAGE_VERSION \
+        tini=$TINI_PACKAGE_VERSION \
     && rm -rf /var/lib/apt/lists/* \
     && rm /etc/ssh/ssh_host_*_key* \
     && useradd --home-dir "$GITOLITE_HOME_PATH" --create-home "$USER" \
@@ -20,8 +22,6 @@ RUN apt-get update \
     && if grep --extended-regex --invert-match '^[a-z0-9_-]+:[\*!]:' /etc/shadow; then exit 1; fi \
     && mkdir "$SSHD_HOST_KEYS_DIR" \
     && chown -c "$USER" "$SSHD_HOST_KEYS_DIR"
-# TODO merge up
-RUN apt-get update && apt-get install --yes tini
 VOLUME $GITOLITE_HOME_PATH
 VOLUME $SSHD_HOST_KEYS_DIR
 

+ 29 - 0
docker-compose.yml

@@ -0,0 +1,29 @@
+version: '2.2'
+
+volumes:
+  ssh_host_keys:
+  gitolite_home:
+
+services:
+  sshd:
+    build: .
+    image: docker.io/fphammerle/gitolite
+    container_name: gitolite
+    environment:
+      GITOLITE_INITIAL_ADMIN_NAME: admin
+      GITOLITE_USER_PUBLIC_KEY_admin: ssh-rsa ...
+      #GITOLITE_USER_PUBLIC_KEY_alice: ssh-rsa ...
+      #GITOLITE_USER_PUBLIC_KEY_bob: ssh-rsa ...
+    read_only: true
+    volumes:
+    - ssh_host_keys:/etc/ssh/host_keys:rw
+    - gitolite_home:/var/lib/gitolite:rw
+    ports:
+    - '127.0.0.1:2200:2200'
+    cap_drop: [ALL]
+    security_opt: [no-new-privileges]
+    # docker-compose >=2.2,<3
+    cpus: 0.4
+    mem_limit: 64M
+
+# https://docs.docker.com/compose/compose-file/compose-file-v2/