Skip to content

Commit f4c2e91

Browse files
author
Matthew Fisher
committed
initial commit
0 parents  commit f4c2e91

9 files changed

Lines changed: 177 additions & 0 deletions

File tree

.travis.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
sudo: required
2+
language: go
3+
go:
4+
- 1.5.1
5+
branches:
6+
only:
7+
- master
8+
services:
9+
- docker
10+
env:
11+
# HACK(bacongobbler): make travis tests work
12+
- DEIS_REGISTRY=travis-ci
13+
install:
14+
- make docker-build
15+
script:
16+
- make test
17+
deploy:
18+
provider: script
19+
script: contrib/ci/deploy.sh
20+
on:
21+
branch: master

Makefile

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
include includes.mk
2+
3+
# Short name: Short name, following [a-zA-Z_], used all over the place.
4+
# Some uses for short name:
5+
# - Docker image name
6+
# - Kubernetes service, rc, pod, secret, volume names
7+
SHORT_NAME := registry
8+
9+
BUILD_TAG ?= git-$(shell git rev-parse --short HEAD)
10+
11+
# Legacy support for DEV_REGISTRY, plus new support for DEIS_REGISTRY.
12+
DEIS_REGISTRY ?= ${DEV_REGISTRY}
13+
14+
IMAGE_PREFIX ?= deis/
15+
16+
# Kubernetes-specific information for RC, Service, and Image.
17+
RC := contrib/kubernetes/manifests/${SHORT_NAME}-rc.tmp.yaml
18+
SVC := contrib/kubernetes/manifests/${SHORT_NAME}-service.yaml
19+
IMAGE := ${DEIS_REGISTRY}/${IMAGE_PREFIX}${SHORT_NAME}:${BUILD_TAG}
20+
21+
all:
22+
@echo "Use a Makefile to control top-level building of the project."
23+
24+
build:
25+
@echo "Nothing to build. Use 'make docker-build' to build the image."
26+
27+
# For cases where we're building from local
28+
# We also alter the RC file to set the image name.
29+
docker-build: check-docker
30+
docker build --rm -t ${IMAGE} rootfs
31+
32+
# Push to a registry that Kubernetes can access.
33+
docker-push: check-docker check-registry
34+
docker push ${IMAGE}
35+
36+
# Deploy is a Kubernetes-oriented target
37+
deploy: kube-service kube-rc
38+
39+
# Some things, like services, have to be deployed before pods. This is an
40+
# example target. Others could perhaps include kube-secret, kube-volume, etc.
41+
kube-service: check-kubectl
42+
kubectl create -f ${SVC}
43+
44+
# When possible, we deploy with RCs.
45+
kube-rc: check-kubectl
46+
kubectl create -f ${RC}
47+
48+
kube-clean: check-kubectl
49+
kubectl delete rc ${SHORT_NAME}
50+
51+
test: check-docker
52+
contrib/ci/test.sh ${IMAGE}
53+
54+
update-manifests:
55+
sed 's#\(image:\) .*#\1 $(IMAGE)#' contrib/kubernetes/manifests/${SHORT_NAME}-rc.yaml \
56+
> ${RC}
57+
58+
.PHONY: all build kube-up kube-down deploy

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Registry
2+
3+
A Docker image registry for use in the Deis open source PaaS.
4+
5+
This Docker image is based on the official docker distribution image.
6+
7+
Please add any [issues](https://github.com/deis/registry/issues) you find with this software to the [Distribution Project](https://github.com/docker/distribution).
8+
9+
10+
## Usage
11+
12+
Please consult the [Makefile](Makefile) for current instructions on how to build, test, push, install, and start deis/registry.
13+
14+
15+
## License
16+
17+
© 2014 Engine Yard, Inc.
18+
19+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at <http://www.apache.org/licenses/LICENSE-2.0>
20+
21+
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

contrib/ci/deploy.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Build and push Docker images to Docker Hub and quay.io.
4+
#
5+
6+
cd "$(dirname "$0")" || exit 1
7+
8+
docker login -e="$DOCKER_EMAIL" -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" docker.io
9+
DEIS_REGISTRY=docker.io IMAGE_PREFIX=deisci/ BUILD_TAG=v2-alpha make -C ../.. docker-build docker-push
10+
docker login -e="$QUAY_EMAIL" -u="$QUAY_USERNAME" -p="$QUAY_PASSWORD" quay.io
11+
DEIS_REGISTRY=quay.io IMAGE_PREFIX=deisci/ BUILD_TAG=v2-alpha make -C ../.. docker-build docker-push

contrib/ci/test.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
3+
set -eoxf pipefail
4+
5+
JOB=$(docker run -d $1)
6+
# let the registry run for a few seconds
7+
sleep 5
8+
# check that the registry is still up
9+
docker ps -q --no-trunc=true | grep $JOB
10+
docker rm -f $JOB
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
apiVersion: v1
2+
kind: ReplicationController
3+
metadata:
4+
name: registry
5+
spec:
6+
replicas: 1
7+
selector:
8+
name: registry
9+
template:
10+
metadata:
11+
labels:
12+
name: registry
13+
spec:
14+
containers:
15+
- name: registry
16+
image: registry:2
17+
env:
18+
- name: REGISTRY_STORAGE_DELETE_ENABLED
19+
value: "true"
20+
- name: REGISTRY_LOG_LEVEL
21+
value: info
22+
ports:
23+
- containerPort: 5000
24+
volumeMounts:
25+
- name: registry-storage
26+
mountPath: /var/lib/registry
27+
volumes:
28+
- name: registry-storage
29+
emptyDir: {}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: registry
5+
spec:
6+
ports:
7+
- port: 5000
8+
selector:
9+
app: registry

includes.mk

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
check-docker:
2+
@if [ -z $$(which docker) ]; then \
3+
echo "Missing \`docker\` client which is required for development"; \
4+
exit 2; \
5+
fi
6+
7+
check-kubectl:
8+
@if [ -z $$(which kubectl) ]; then \
9+
echo "Missing \`kubectl\` client which is required for development"; \
10+
exit 2; \
11+
fi
12+
13+
check-registry:
14+
@if [ -z "$$DEIS_REGISTRY" ] && [ -z "$$DEV_REGISTRY" ]; then \
15+
echo "DEIS_REGISTRY is not exported"; \
16+
exit 2; \
17+
fi

rootfs/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
FROM registry:2

0 commit comments

Comments
 (0)