Skip to content

Commit

Permalink
issue #1 Add redis version 3.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
irvis committed Sep 10, 2016
1 parent c326b43 commit 2420ffb
Show file tree
Hide file tree
Showing 10 changed files with 126 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.DS_Store
.idea
build/containers
5 changes: 5 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### [3.0.5]

* From image: alpine:3.4
* Redis 3.2.0

### [3.0.5]

* From image: alpine:3.3
Expand Down
9 changes: 3 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
FROM imega/base-builder:1.1.0
FROM imega/base-builder:1.2.0

EXPOSE 6379
MAINTAINER Dmitry Gavriloff <info@imega.ru>

COPY . /

RUN apk add --update redis && \
rm -rf /var/cache/apk/*
ADD build/rootfs.tar.gz /

CMD ["redis-server","/redis.conf"]
42 changes: 42 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
DOCKER_RM = false

build: buildfs
@docker build -t imega/redis .

buildfs:
@docker run --rm=$(DOCKER_RM) \
-v $(CURDIR)/runner:/runner \
-v $(CURDIR)/build:/build \
-v $(CURDIR)/src:/src \
imega/base-builder \
--packages="redis"

build/containers/container_data:
@mkdir -p $(shell dirname $@)
@docker run -d --name container_data imega/redis
@touch $@

discovery_data: build/containers/container_data
@while [ "`docker inspect -f {{.State.Running}} container_data`" != "true" ]; do \
echo "wait db"; sleep 0.3; \
done

get_containers:
$(eval CONTAINERS := $(subst build/containers/,,$(shell find build/containers -type f)))

stop: get_containers
@-docker stop $(CONTAINERS)

clean: stop
@-docker rm -fv $(CONTAINERS)
@-rm -rf build/containers/*

test: build discovery_data
@docker run --rm=$(DOCKER_RM) \
-v $(CURDIR)/tests:/data \
-w /data \
--link container_data:server \
alpine \
sh -c 'apk add --update bash && ./test.sh server'

.PHONY: build
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
# Redis
This is docker image to run the [redis](http://redis.io).

[![](https://images.microbadger.com/badges/image/imega/redis.svg)](http://microbadger.com/images/imega/redis "Get your own image badge on microbadger.com")
[![](https://images.microbadger.com/badges/image/imega/redis.svg)](http://microbadger.com/images/imega/redis "Get your own image badge on microbadger.com") [![CircleCI](https://circleci.com/gh/imega-docker/redis.svg?style=svg)](https://circleci.com/gh/imega-docker/redis) [![GitHub stars](https://img.shields.io/github/stars/badges/shields.svg?style=social&label=Star&maxAge=2592000)](https://github.com/imega-docker/redis)

Image size: 5.7 MB

From image: alpine:3.3
Image size: 3.2 MB

From image: alpine:3.4

## Usage
```
$ docker run -d -v `pwd`:/data imega/redis:1.0.0
$ docker run -d -v `pwd`:/data imega/redis
```

## Alpine Packages
* musl (1.1.14-r11)
* busybox (1.24.2-r11)
* redis (3.2.0-r0)

## The MIT License (MIT)

Copyright © 2015 iMega <info@imega.ru>
Expand Down
Binary file added build/rootfs.tar.gz
Binary file not shown.
11 changes: 11 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
machine:
services:
- docker

dependencies:
pre:
- sudo apt-get install -y make

test:
pre:
- make test
3 changes: 3 additions & 0 deletions runner/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

cp $SRC/redis.conf $ROOTFS/redis.conf
2 changes: 2 additions & 0 deletions redis.conf → src/redis.conf
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,5 @@ client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes
bind 0.0.0.0
protected-mode no
49 changes: 49 additions & 0 deletions tests/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bash

printf '%.0s-' {1..80}
echo

URL=$1

COUNT_TESTS=0
COUNT_TESTS_FAIL=0

assertTrue() {
testName="$3"
pad=$(printf '%0.1s' "."{1..80})
padlength=78

if [ "$1" != "$2" ]; then
printf ' %s%*.*s%s' "$3" 0 $((padlength - ${#testName} - 4)) "$pad" "Fail"
printf ' (expected %s, assertion %s)\n' "$1" "$2"
let "COUNT_TESTS_FAIL++"
else
printf ' %s%*.*s%s\n' "$3" 0 $((padlength - ${#testName} - 2)) "$pad" "Ok"
let "COUNT_TESTS++"
fi
}

testSet() {
ACTUAL=$(echo "SET my-key 'my-value'" | nc server 6379 2>/dev/null | cat | sed 's/\r//g')

assertTrue "+OK" $ACTUAL "$FUNCNAME"
}

testGet() {
ACTUAL=$(echo "GET my-key" | nc server 6379 2>/dev/null | cat | sed 's/[8\$\r]//g' | tr -d '[[:space:]]')

assertTrue "my-value" $ACTUAL "$FUNCNAME"
}

testSet
testGet

printf '%.0s-' {1..80}
echo
printf 'Total test: %s, fail: %s\n\n' "$COUNT_TESTS" "$COUNT_TESTS_FAIL"

if [ $COUNT_TESTS_FAIL -gt 0 ]; then
exit 1
fi

exit 0

0 comments on commit 2420ffb

Please sign in to comment.