Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
beagle-rcache-image
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
market
beagle-rcache-image
Commits
5c5c7946
Commit
5c5c7946
authored
Mar 18, 2020
by
iamabhishek-dubey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed image architecture
parent
59f78231
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
20 deletions
+40
-20
Dockerfile
Dockerfile
+9
-2
entrypoint.sh
entrypoint.sh
+5
-18
redis.conf
redis.conf
+8
-0
run.sh
run.sh
+18
-0
No files found.
Dockerfile
View file @
5c5c7946
...
@@ -10,7 +10,7 @@ ARG REDIS_DOWNLOAD_URL="http://download.redis.io/"
...
@@ -10,7 +10,7 @@ ARG REDIS_DOWNLOAD_URL="http://download.redis.io/"
ARG
REDIS_VERSION="stable"
ARG
REDIS_VERSION="stable"
RUN
addgroup
-S
-g
100
0 redis
&&
adduser
-S
-G
redis
-u
999
redis
&&
\
RUN
addgroup
-S
-g
100
1 redis
&&
adduser
-S
-G
redis
-u
1001
redis
&&
\
apk add
--no-cache
su-exec tzdata make curl build-base linux-headers bash
apk add
--no-cache
su-exec tzdata make curl build-base linux-headers bash
RUN
curl
-fL
-Lo
/tmp/redis-
${
REDIS_VERSION
}
.tar.gz
${
REDIS_DOWNLOAD_URL
}
/redis-
${
REDIS_VERSION
}
.tar.gz
&&
\
RUN
curl
-fL
-Lo
/tmp/redis-
${
REDIS_VERSION
}
.tar.gz
${
REDIS_DOWNLOAD_URL
}
/redis-
${
REDIS_VERSION
}
.tar.gz
&&
\
...
@@ -21,14 +21,21 @@ RUN curl -fL -Lo /tmp/redis-${REDIS_VERSION}.tar.gz ${REDIS_DOWNLOAD_URL}/redis-
...
@@ -21,14 +21,21 @@ RUN curl -fL -Lo /tmp/redis-${REDIS_VERSION}.tar.gz ${REDIS_DOWNLOAD_URL}/redis-
make
install
&&
\
make
install
&&
\
mkdir
-p
/etc/redis
&&
\
mkdir
-p
/etc/redis
&&
\
cp
-f
*
.conf /etc/redis
&&
\
cp
-f
*
.conf /etc/redis
&&
\
rm
-rf
/tmp/redis-
${
REDIS_VERSION
}*
rm
-rf
/tmp/redis-
${
REDIS_VERSION
}*
&&
\
apk del curl make
COPY
redis.conf /etc/redis/redis.conf
COPY
entrypoint.sh /usr/bin/entrypoint.sh
COPY
entrypoint.sh /usr/bin/entrypoint.sh
COPY
run.sh /usr/bin/run.sh
VOLUME
["/data"]
VOLUME
["/data"]
WORKDIR
/data
WORKDIR
/data
USER
redis
EXPOSE
6379
EXPOSE
6379
ENTRYPOINT
["/usr/bin/entrypoint.sh"]
ENTRYPOINT
["/usr/bin/entrypoint.sh"]
entrypoint.sh
View file @
5c5c7946
#!/bin/bash
#!/bin/bash
set
-eu
set
-ex
generate_common_config
()
{
{
echo
"bind 0.0.0.0"
echo
protected-mode
yes
echo
tcp-backlog 511
echo timeout
0
echo
tcp-keepalive 300
echo
daemonize no
echo
supervised no
echo
pidfile /var/run/redis.pid
}
>
/etc/redis/redis.conf
}
set_redis_password
()
{
set_redis_password
()
{
if
[
-z
"
${
REDIS_PASSWORD
}
"
]
;
then
if
[
[
-z
"
${
REDIS_PASSWORD
}
"
]
]
;
then
echo
"Redis is running without password which is not recommended"
echo
"Redis is running without password which is not recommended"
else
else
{
{
...
@@ -27,7 +14,7 @@ set_redis_password() {
...
@@ -27,7 +14,7 @@ set_redis_password() {
}
}
redis_mode_setup
()
{
redis_mode_setup
()
{
if
[
"
${
SETUP_MODE
}
"
=
"cluster"
]
;
then
if
[
[
"
${
SETUP_MODE
}
"
==
"cluster"
]
]
;
then
{
{
echo
cluster-enabled
yes
echo
cluster-enabled
yes
echo
cluster-config-file nodes.conf
echo
cluster-config-file nodes.conf
...
@@ -39,15 +26,15 @@ redis_mode_setup() {
...
@@ -39,15 +26,15 @@ redis_mode_setup() {
}
}
start_redis
()
{
start_redis
()
{
echo
"Starting redis service
"
echo
"Starting redis service
.....
"
redis-server /etc/redis/redis.conf
redis-server /etc/redis/redis.conf
}
}
main_function
()
{
main_function
()
{
generate_common_config
set_redis_password
set_redis_password
redis_mode_setup
redis_mode_setup
start_redis
start_redis
redis_server_mode
}
}
main_function
main_function
redis.conf
0 → 100644
View file @
5c5c7946
bind
0
.
0
.
0
.
0
protected
-
mode
yes
tcp
-
backlog
511
timeout
0
tcp
-
keepalive
300
daemonize
no
supervised
no
pidfile
/
var
/
run
/
redis
.
pid
run.sh
0 → 100755
View file @
5c5c7946
#!/bin/bash
redis_server_mode
()
{
if
[[
"
${
SERVER_MODE
}
"
==
"master"
]]
;
then
echo
"Redis server mode is master"
elif
[[
"
${
SERVER_MODE
}
"
==
"slave"
]]
;
then
echo
"Redis server mode is slave"
if
[[
-z
"
${
REDIS_PASSWORD
}
"
]]
;
then
redis-cli
--add-node
"
${
SLAVE_IP
}
"
"
${
MASTER_IP
}
"
--cluster-slave
else
redis-cli
--add-node
"
${
SLAVE_IP
}
"
"
${
MASTER_IP
}
"
--cluster-slave
-a
"
${
REDIS_PASSWORD
}
"
fi
else
echo
"Redis server mode is standalone"
fi
}
redis_server_mode
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