app-emulation/docker-registry: new package
authorZac Medico <zmedico@gentoo.org>
Mon, 25 Apr 2016 07:45:24 +0000 (00:45 -0700)
committerZac Medico <zmedico@gentoo.org>
Mon, 25 Apr 2016 07:47:57 +0000 (00:47 -0700)
Package-Manager: portage-2.2.28

app-emulation/docker-registry/Manifest [new file with mode: 0644]
app-emulation/docker-registry/docker-registry-2.4.0.ebuild [new file with mode: 0644]
app-emulation/docker-registry/files/config.yml [new file with mode: 0644]
app-emulation/docker-registry/files/registry.confd [new file with mode: 0644]
app-emulation/docker-registry/files/registry.initd [new file with mode: 0644]
app-emulation/docker-registry/files/registry.logrotated [new file with mode: 0644]
app-emulation/docker-registry/files/registry.service [new file with mode: 0644]
app-emulation/docker-registry/metadata.xml [new file with mode: 0644]

diff --git a/app-emulation/docker-registry/Manifest b/app-emulation/docker-registry/Manifest
new file mode 100644 (file)
index 0000000..9607b5c
--- /dev/null
@@ -0,0 +1 @@
+DIST docker-registry-2.4.0.tar.gz 1294478 SHA256 cfd0c6212a05c047fa6a5b9093493d2de0b438936f2d7318a902263a4a3d7b0f SHA512 668ba35adbe897f73e93e3ec8766123a70b4d2b0d57d4ec3e9f77f6d60d381184acc331b04ab0391f4c648da223dd2338a4065027e6c63aa86b1f1a039d7e300 WHIRLPOOL b07b0f79b97547c33fa2b64bcf85cc1e2bac3e17c38d6bda18a5ed7cfc500938ee29c26c15fbbc5110b22c2d28764674034cf325519261b01ada71deb6b541be
diff --git a/app-emulation/docker-registry/docker-registry-2.4.0.ebuild b/app-emulation/docker-registry/docker-registry-2.4.0.ebuild
new file mode 100644 (file)
index 0000000..08c7199
--- /dev/null
@@ -0,0 +1,52 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit golang-vcs-snapshot systemd user
+
+KEYWORDS="~amd64"
+EGO_PN="github.com/docker/distribution/..."
+EGIT_COMMIT="v${PV}"
+SRC_URI="https://${EGO_PN%/*}/archive/${EGIT_COMMIT}.tar.gz -> ${P}.tar.gz"
+DESCRIPTION="Docker Registry 2.0"
+HOMEPAGE="https://${EGO_PN%/*}"
+LICENSE="Apache-2.0"
+SLOT="0/${PVR}"
+IUSE=""
+DEPEND=">=dev-lang/go-1.5"
+SVCNAME=registry
+
+pkg_setup() {
+       enewgroup ${SVCNAME}
+       enewuser ${SVCNAME} -1 -1 /dev/null ${SVCNAME}
+}
+
+src_compile() {
+       GOPATH="${S}" GO15VENDOREXPERIMENT=1 \
+               go install -v -work -x ${EGO_BUILD_FLAGS} "${EGO_PN}" || die
+}
+
+src_install() {
+       golang_install_pkgs
+       exeinto /usr/libexec/${PN}
+       doexe "${S}"/bin/*
+       insinto /etc/docker/registry
+       newins "${FILESDIR}/config.yml" config.yml.example
+       newinitd "${FILESDIR}/${SVCNAME}.initd" "${SVCNAME}"
+       newconfd "${FILESDIR}/${SVCNAME}.confd" "${SVCNAME}"
+       systemd_dounit "${FILESDIR}/${SVCNAME}.service"
+       keepdir /var/{lib,log}/${SVCNAME}
+       fowners ${SVCNAME}:${SVCNAME} /var/{lib,log}/${SVCNAME}
+       insinto /etc/logrotate.d
+       newins "${FILESDIR}/${SVCNAME}.logrotated" "${SVCNAME}"
+}
+
+golang_install_pkgs() {
+       insinto $(dirname "${EPREFIX}$(get_golibdir)/src/${EGO_PN%/*}")
+       rm -rf "${S}"/src/${EGO_PN%/*}/.git* \
+               "${S}"/{src,pkg/$(go env GOOS)_$(go env GOARCH)}/${EGO_PN%/*}/vendor
+       doins -r "${S}"/src/${EGO_PN%/*}
+       insinto $(dirname "${EPREFIX}$(get_golibdir)/pkg/$(go env GOOS)_$(go env GOARCH)/${EGO_PN%/*}")
+       doins -r "${S}"/pkg/$(go env GOOS)_$(go env GOARCH)/${EGO_PN%/*}{,.a}
+}
diff --git a/app-emulation/docker-registry/files/config.yml b/app-emulation/docker-registry/files/config.yml
new file mode 100644 (file)
index 0000000..b5700e1
--- /dev/null
@@ -0,0 +1,18 @@
+version: 0.1
+log:
+  fields:
+    service: registry
+storage:
+    cache:
+        blobdescriptor: inmemory
+    filesystem:
+        rootdirectory: /var/lib/registry
+http:
+    addr: :5000
+    headers:
+        X-Content-Type-Options: [nosniff]
+health:
+  storagedriver:
+    enabled: true
+    interval: 10s
+    threshold: 3
diff --git a/app-emulation/docker-registry/files/registry.confd b/app-emulation/docker-registry/files/registry.confd
new file mode 100644 (file)
index 0000000..bfa97f1
--- /dev/null
@@ -0,0 +1,2 @@
+# arguments for docker-registry
+command_args="serve /etc/docker/registry/config.yml"
diff --git a/app-emulation/docker-registry/files/registry.initd b/app-emulation/docker-registry/files/registry.initd
new file mode 100644 (file)
index 0000000..4df83f3
--- /dev/null
@@ -0,0 +1,25 @@
+#!/sbin/openrc-run
+# Copyright 2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+description="Docker Registry 2.0"
+pidfile=${pidfile:-"/run/${SVCNAME}/${SVCNAME}.pid"}
+user=${SVCNAME}
+group=${SVCNAME}
+
+command="/usr/libexec/docker-${SVCNAME}/${SVCNAME}"
+command_args="${command_args:-serve /etc/docker/registry/config.yml}"
+command_background="true"
+start_stop_daemon_args="--user ${user} --group ${group} \
+       --stdout /var/log/${SVCNAME}/${SVCNAME}.log \
+       --stderr /var/log/${SVCNAME}/${SVCNAME}.log"
+
+depend() {
+       need net
+       after net
+}
+
+start_pre() {
+       checkpath -d -m 0755 -o "${user}":"${group}" "${pidfile%/*}"
+}
diff --git a/app-emulation/docker-registry/files/registry.logrotated b/app-emulation/docker-registry/files/registry.logrotated
new file mode 100644 (file)
index 0000000..7f89ba2
--- /dev/null
@@ -0,0 +1,7 @@
+/var/log/registry/registry.log {
+       su registry registry
+       missingok
+       size 5M
+       rotate 3
+       compress
+}
diff --git a/app-emulation/docker-registry/files/registry.service b/app-emulation/docker-registry/files/registry.service
new file mode 100644 (file)
index 0000000..14ff5f9
--- /dev/null
@@ -0,0 +1,13 @@
+[Unit]
+Description=Docker Registry 2.0
+Requires=network-online.target
+After=network-online.target
+
+[Service]
+User=registry
+PrivateDevices=Yes
+Environment="DOCKER_REGISTRY_ARGS=serve /etc/docker/registry/config.yml"
+ExecStart=/usr/libexec/docker-registry/registry $DOCKER_REGISTRY_ARGS
+
+[Install]
+WantedBy=multi-user.target
diff --git a/app-emulation/docker-registry/metadata.xml b/app-emulation/docker-registry/metadata.xml
new file mode 100644 (file)
index 0000000..4f66ba3
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+  <maintainer type="person">
+    <email>zmedico@gentoo.org</email>
+  </maintainer>
+  <upstream>
+    <remote-id type="github">docker/distribution</remote-id>
+  </upstream>
+</pkgmetadata>