Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
vernemq
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
stack
vernemq
Commits
6d98b5d4
Commit
6d98b5d4
authored
Nov 04, 2018
by
Chavee Issariyapat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
switch to alpine
parent
ede2ef6d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
44 deletions
+30
-44
redis/Dockerfile
+25
-40
redis/docker-entrypoint.sh
+5
-4
No files found.
redis/Dockerfile
View file @
6d98b5d4
FROM
debian:stretch-slim
FROM
alpine:3.8
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN
groupadd
-r
redis
&&
useradd
-r
-g
redis redis
RUN
addgroup
-S
redis
&&
adduser
-S
-G
redis redis
# grab gosu for easy step-down from root
# https://github.com/tianon/gosu/releases
ENV
GOSU_VERSION 1.10
RUN
set
-ex
;
\
\
fetchDeps
=
"
\
ca-certificates
\
dirmngr
\
gnupg
\
wget
\
"
;
\
apt-get update
;
\
apt-get install
-y
--no-install-recommends
$fetchDeps
;
\
rm
-rf
/var/lib/apt/lists/
*
;
\
\
dpkgArch
=
"
$(
dpkg
--print-architecture
| awk
-F-
'{ print $NF }'
)
"
;
\
wget
-O
/usr/local/bin/gosu
"https://github.com/tianon/gosu/releases/download/
$GOSU_VERSION
/gosu-
$dpkgArch
"
;
\
wget
-O
/usr/local/bin/gosu.asc
"https://github.com/tianon/gosu/releases/download/
$GOSU_VERSION
/gosu-
$dpkgArch
.asc"
;
\
export
GNUPGHOME
=
"
$(
mktemp
-d
)
"
;
\
gpg
--keyserver
ha.pool.sks-keyservers.net
--recv-keys
B42F6819007F00F88E364FD4036A9C25BF357DD4
;
\
gpg
--batch
--verify
/usr/local/bin/gosu.asc /usr/local/bin/gosu
;
\
gpgconf
--kill
all
;
\
rm
-r
"
$GNUPGHOME
"
/usr/local/bin/gosu.asc
;
\
chmod +x /usr/local/bin/gosu
;
\
gosu nobody
true
;
\
\
apt-get purge
-y
--auto-remove
$fetchDeps
RUN
apk add
--no-cache
\
# grab su-exec for easy step-down from root
'su-exec>=0.2' \
# add tzdata for https://github.com/docker-library/redis/issues/138
tzdata
ENV
REDIS_VERSION 5.0.0
ENV
REDIS_DOWNLOAD_URL http://download.redis.io/releases/redis-5.0.0.tar.gz
...
...
@@ -38,17 +16,14 @@ ENV REDIS_DOWNLOAD_SHA 70c98b2d0640b2b73c9d8adb4df63bcb62bad34b788fe46d1634b6cf8
# for redis-sentinel see: http://redis.io/topics/sentinel
RUN
set
-ex
;
\
\
buildDeps
=
'
\
ca-certificates
\
wget
\
\
apk add
--no-cache
--virtual
.build-deps
\
coreutils
\
gcc
\
libc6-dev
\
jemalloc-dev
\
linux-headers
\
make
\
'
;
\
apt-get update
;
\
apt-get install
-y
$buildDeps
--no-install-recommends
;
\
rm
-rf
/var/lib/apt/lists/
*
;
\
musl-dev
\
;
\
\
wget
-O
redis.tar.gz
"
$REDIS_DOWNLOAD_URL
"
;
\
echo
"
$REDIS_DOWNLOAD_SHA
*redis.tar.gz"
| sha256sum
-c
-
;
\
...
...
@@ -71,7 +46,16 @@ RUN set -ex; \
\
rm -r /usr/src/redis; \
\
apt-get purge -y --auto-remove $buildDeps
runDeps="$( \
scanelf --needed --nobanner --format '%n
#p' --recursive /usr/local \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
)"; \
apk add --virtual .redis-rundeps $runDeps; \
apk del .build-deps; \
\
redis-server --version
RUN
mkdir /data
&&
chown redis:redis /data
VOLUME
/data
...
...
@@ -81,4 +65,4 @@ COPY docker-entrypoint.sh /usr/local/bin/
ENTRYPOINT
["docker-entrypoint.sh"]
EXPOSE
6379
CMD
["redis-server"]
CMD
["redis-server"]
\ No newline at end of file
redis/docker-entrypoint.sh
View file @
6d98b5d4
...
...
@@ -4,13 +4,13 @@ set -e
# first arg is `-f` or `--some-option`
# or first arg is `something.conf`
if
[
"
${
1
#-
}
"
!=
"
$1
"
]
||
[
"
${
1
%.conf
}
"
!=
"
$1
"
]
;
then
set
--
redis-server
"
$@
"
set
--
redis-server
"
$@
"
fi
# allow the container to be started with `--user`
if
[
"
$1
"
=
'redis-server'
-a
"
$(
id
-u
)
"
=
'0'
]
;
then
find
.
\!
-user
redis
-exec
chown redis
'{}'
+
exec
gosu
redis
"
$0
"
"
$@
"
find
.
\!
-user
redis
-exec
chown redis
'{}'
+
exec
su-exec
redis
"
$0
"
"
$@
"
fi
exec
"
$@
"
exec
"
$@
"
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment