image-riak-base/Dockerfile.sh

77 lines
2.2 KiB
Bash
Raw Normal View History

2017-10-26 13:46:18 +00:00
#!/bin/sh
cat <<EOF
2017-10-30 10:19:59 +00:00
FROM ${REGISTRY}/${ORG_NAME}/build:${BUILD_IMAGE_TAG} as build
RUN rm -r /etc/portage/repos.conf/*.conf \
2020-01-10 13:15:34 +00:00
/etc/portage/savedconfig/* \
/etc/portage/package.mask/*
COPY files/portage/ /etc/portage
COPY portage/ /usr/portage
COPY overlays/ /var/lib/layman
2017-10-26 13:46:18 +00:00
COPY files/install.sh /
2020-02-07 10:31:46 +00:00
COPY files/install-riak.sh /
COPY files/vars.config /
2020-02-26 19:37:29 +00:00
COPY files/riak.patch /
COPY files/riak_core.patch /
2020-02-07 10:31:46 +00:00
COPY files/erlang_otp.patch /
RUN /install.sh
2020-02-07 10:31:46 +00:00
RUN /install-riak.sh
2017-10-30 10:19:59 +00:00
# Install custom hooks
COPY files/prestart.d /tmp/portage-root/etc/riak/prestart.d
COPY files/poststart.d /tmp/portage-root/etc/riak/poststart.d
# Install custom start script
COPY files/riak-cluster.sh /tmp/portage-root/riak-cluster.sh
#####################################################################
# Riak image
FROM scratch
2017-10-30 10:19:59 +00:00
COPY --from=build /tmp/portage-root/ /
COPY --from=build /usr/local/ssl /usr/local
# Prepare directrories
RUN mkdir -p /etc/riak/schemas /etc/riak/prestart.d /etc/riak/poststart.d \
/usr/lib/riak/ /var/lib/riak /var/log/riak
# Copy riak sources
COPY --from=build /opt/riak/rel/riak/bin/riak* /usr/sbin/
COPY --from=build /opt/riak/rel/riak/etc/* /etc/riak/
COPY --from=build /opt/riak/rel/riak/erts-5.10.3 /usr/lib/riak/erts-5.10.3
COPY --from=build /opt/riak/rel/riak/lib /usr/lib/riak/lib
COPY --from=build /opt/riak/rel/riak/releases /usr/lib/riak/releases
RUN busybox --install
2017-10-30 10:19:59 +00:00
LABEL com.rbkmoney.${SERVICE_NAME}.parent=null \
com.rbkmoney.${SERVICE_NAME}.parent_tag=null \
com.rbkmoney.${SERVICE_NAME}.branch=${BRANCH} \
com.rbkmoney.${SERVICE_NAME}.commit_id=${COMMIT} \
com.rbkmoney.${SERVICE_NAME}.commit_number=`git rev-list --count HEAD`
# Expose default ports
EXPOSE 8087
EXPOSE 8098
# Create riak user/group
RUN touch /etc/group /etc/passwd
RUN adduser -u 0 -g wheel -D -h /root root; \
adduser -u 102 -g riak -D -h /var/lib/riak riak; \
chown -R riak:riak /var/lib/riak /var/log/riak
# Expose volumes for data and logs
VOLUME /var/log/riak
VOLUME /var/lib/riak
# Prepare for bootstrapping schemas
RUN mkdir -p /etc/riak/schemas
2020-02-26 19:37:29 +00:00
ENV RIAK_VERSION 2.9.1
ENV RIAK_HOME /usr/lib/riak
ENV RIAK_FLAVOR KV
WORKDIR /var/lib/riak
RUN chmod a+x /riak-cluster.sh
CMD ["/riak-cluster.sh"]
2017-10-26 13:46:18 +00:00
EOF