File size: 1,250 Bytes
7cc5302
 
f963be1
7cc5302
 
7b478c2
7cc5302
 
57c9c73
7cc5302
 
da9939e
7cc5302
13ab8ed
7cc5302
 
 
 
 
7655bc8
7cc5302
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51d46d3
7cc5302
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# # Use the official Ubuntu 18.04 image as a base
# FROM ubuntu:18.04

# # Expose the default Redis port
# EXPOSE 7860

# # Update the system and install Redis
# RUN apt-get update && apt-get install -y redis-server

# RUN mkdir -p /etc/lib/redis
# RUN chmod -R 777 /etc/lib/redis

# COPY redis.conf /etc/redis/redis.conf

# # Run the Redis server as the main process with the configuration file
# CMD ["redis-server", "/etc/redis/redis.conf"]


# Pull base image.
FROM ubuntu

# Install Redis.
RUN \
  cd /tmp && \
  wget http://download.redis.io/redis-stable.tar.gz && \
  tar xvzf redis-stable.tar.gz && \
  cd redis-stable && \
  make && \
  make install && \
  cp -f src/redis-sentinel /usr/local/bin && \
  mkdir -p /etc/redis && \
  cp -f *.conf /etc/redis && \
  rm -rf /tmp/redis-stable* && \
  sed -i 's/^\(bind .*\)$/# \1/' /etc/redis/redis.conf && \
  sed -i 's/^\(daemonize .*\)$/# \1/' /etc/redis/redis.conf && \
  sed -i 's/^\(dir .*\)$/# \1\ndir \/data/' /etc/redis/redis.conf && \
  sed -i 's/^\(logfile .*\)$/# \1/' /etc/redis/redis.conf

# Define mountable directories.
VOLUME ["/data"]

# Define working directory.
WORKDIR /data

# Define default command.
CMD ["redis-server", "/etc/redis/redis.conf"]

# Expose ports.
EXPOSE 6379