-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
93 lines (71 loc) · 3.22 KB
/
Dockerfile
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
FROM alpine:3.6
MAINTAINER Abner G Jacobsen - http://daspanel.com <admin@daspanel.com>
# Parse Daspanel common arguments for the build command.
ARG VERSION
ARG VCS_URL
ARG VCS_REF
ARG BUILD_DATE
ARG S6_OVERLAY_VERSION=v1.19.1.1
ARG DASPANEL_IMG_NAME=redis
ARG DASPANEL_OS_VERSION=alpine3.6
# Set default env variables
ENV \
# Stop container initialization if error occurs in cont-init.d, fix-attrs.d script's
S6_BEHAVIOUR_IF_STAGE2_FAILS=2 \
# Timezone
TZ="UTC" \
# DASPANEL defaults
DASPANEL_WAIT_FOR_API="YES" \
# Redis
REDIS_VERSION="3.2.8"
# A little bit of metadata management.
# See http://label-schema.org/
LABEL org.label-schema.schema-version="1.0" \
org.label-schema.build-date=$BUILD_DATE \
org.label-schema.version=$VERSION \
org.label-schema.vcs-url=$VCS_URL \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.name="daspanel/redis" \
org.label-schema.description="This service provides REDIS server to Daspanel sites."
# Inject files in container file system
COPY rootfs /
RUN set -x \
# Initial OS bootstrap - required
&& sh /opt/daspanel/bootstrap/${DASPANEL_OS_VERSION}/00_base \
# Install Daspanel base - common layer for all container's independent of the OS and init system
&& wget -O /tmp/opt-daspanel.zip "https://github.com/daspanel/rootfs-base/releases/download/0.1.0/opt-daspanel.zip" \
&& unzip -o -d / /tmp/opt-daspanel.zip \
# Install Daspanel bootstrap for Alpine Linux with S6 Overlay Init system
&& wget -O /tmp/alpine-s6.zip "https://github.com/daspanel/rootfs-base/releases/download/0.1.0/alpine-s6.zip" \
&& unzip -o -d / /tmp/alpine-s6.zip \
# Bootstrap the system (TBD)
# Install s6 overlay init system
&& wget https://github.com/just-containers/s6-overlay/releases/download/$S6_OVERLAY_VERSION/s6-overlay-amd64.tar.gz --no-check-certificate -O /tmp/s6-overlay.tar.gz \
&& tar xvfz /tmp/s6-overlay.tar.gz -C / \
&& rm -f /tmp/s6-overlay.tar.gz \
# Install build environment packages
&& sh /opt/daspanel/bootstrap/${DASPANEL_OS_VERSION}/${DASPANEL_IMG_NAME}/00_buildenv \
# Install redis Redis
&& wget -O redis.tar.gz http://download.redis.io/releases/redis-$REDIS_VERSION.tar.gz \
&& mkdir -p /usr/src/redis \
&& tar -xzf redis.tar.gz -C /usr/src/redis --strip-components=1 \
&& rm redis.tar.gz \
# Disable Redis protected mode [1] as it is unnecessary in context
# of Docker. Ports are not automatically exposed when running inside
# Docker, but rather explicitely by specifying -p / -P.
&& grep -q '^#define CONFIG_DEFAULT_PROTECTED_MODE 1$' /usr/src/redis/src/server.h \
&& sed -ri 's!^(#define CONFIG_DEFAULT_PROTECTED_MODE) 1$!\1 0!' /usr/src/redis/src/server.h \
&& grep -q '^#define CONFIG_DEFAULT_PROTECTED_MODE 0$' /usr/src/redis/src/server.h \
&& make -C /usr/src/redis \
&& make -C /usr/src/redis install \
&& rm -r /usr/src/redis \
# Remove build environment packages
&& sh /opt/daspanel/bootstrap/${DASPANEL_OS_VERSION}/${DASPANEL_IMG_NAME}/09_cleanbuildenv \
# Cleanup
&& rm -rf /tmp/* \
&& rm -rf /var/cache/apk/*
# Let's S6 control the init system
ENTRYPOINT ["/init"]
CMD []
# Expose ports for the service
EXPOSE 6379