Skip to content

Commit

Permalink
dev: adjust dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangxu19830126 committed Dec 29, 2018
1 parent a50b58b commit 73e8455
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 157 deletions.
8 changes: 8 additions & 0 deletions Dockerfile-base
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM centos:7

RUN yum -y install snappy-devel \
&& yum -y install zlib-devel \
&& yum -y install bzip2-devel \
&& yum -y install epel-release \
&& yum -y install jemalloc-devel \
&& yum -y install gtest-devel
20 changes: 8 additions & 12 deletions Dockerfile-build
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
FROM deepfabric/elasticell-dev

RUN mkdir -p /apps/deepfabric

COPY ./entrypoint-build.sh /apps/deepfabric

RUN apt-get update \
&& apt-get install -y git \
&& chmod +x /apps/deepfabric/entrypoint-build.sh

WORKDIR /apps/deepfabric
ENTRYPOINT ./entrypoint-build.sh
FROM deepfabric/centos

RUN yum -y install go \
&& yum -y install make \
&& go get github.com/funny/slab \
&& go get github.com/deepfabric/c-nemo \
&& go get github.com/deepfabric/go-nemo

26 changes: 7 additions & 19 deletions Dockerfile-cell
Original file line number Diff line number Diff line change
@@ -1,23 +1,11 @@
FROM golang:1.9.2
FROM deepfabric/build as builder

RUN mkdir -p /apps/deepfabric
COPY . /root/go/src/github.com/deepfabric/elasticell
WORKDIR /root/go/src/github.com/deepfabric/elasticell

COPY ./dist/cell /apps/deepfabric
COPY ./entrypoint.sh /apps/deepfabric
RUN make cell

RUN apt-get update \
&& apt-get -y install libsnappy-dev \
&& apt-get -y install zlib1g-dev \
&& apt-get -y install libbz2-dev \
&& apt-get -y install libgtest-dev \
&& apt-get -y install libjemalloc-dev
FROM deepfabric/centos
COPY --from=builder /root/go/src/github.com/deepfabric/elasticell/dist/cell /usr/local/bin/cell

RUN chmod +x /apps/deepfabric/cell \
&& chmod +x /apps/deepfabric/entrypoint.sh

ENV ELASTICELL_HOME=/apps/deepfabric
ENV ELASTICELL_EXEC=cell

WORKDIR /apps/deepfabric

ENTRYPOINT ["/bin/sh", "./entrypoint.sh"]
ENTRYPOINT ["/usr/local/bin/cell"]
11 changes: 0 additions & 11 deletions Dockerfile-dev

This file was deleted.

27 changes: 17 additions & 10 deletions Dockerfile-pd
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
FROM ubuntu:16.04
FROM deepfabric/build as builder

RUN mkdir -p /apps/deepfabric
COPY . /root/go/src/github.com/deepfabric/elasticell
WORKDIR /root/go/src/github.com/deepfabric/elasticell

COPY ./dist/pd /apps/deepfabric
COPY ./entrypoint.sh /apps/deepfabric
RUN make pd

RUN chmod +x /apps/deepfabric/pd \
&& chmod +x /apps/deepfabric/entrypoint.sh

ENV ELASTICELL_HOME=/apps/deepfabric
ENV ELASTICELL_EXEC=pd
FROM alpine:latest

WORKDIR /apps/deepfabric
COPY --from=builder /root/go/src/github.com/deepfabric/elasticell/dist/pd /usr/local/bin/pd

ENTRYPOINT ["/bin/sh", "./entrypoint.sh"]
RUN mkdir -p /var/pd/
RUN mkdir -p /var/lib/pd/

# Alpine Linux doesn't use pam, which means that there is no /etc/nsswitch.conf,
# but Golang relies on /etc/nsswitch.conf to check the order of DNS resolving
# (see https://github.com/golang/go/commit/9dee7771f561cf6aee081c0af6658cc81fac3918)
# To fix this we just create /etc/nsswitch.conf and add the following line:
RUN echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' >> /etc/nsswitch.conf

# Define default command.
ENTRYPOINT ["/usr/local/bin/pd"]
27 changes: 17 additions & 10 deletions Dockerfile-proxy
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
FROM ubuntu:16.04
FROM deepfabric/build as builder

RUN mkdir -p /apps/deepfabric
RUN go get github.com/deepfabric/elasticell-proxy

COPY ./dist/redis-proxy /apps/deepfabric
COPY ./entrypoint.sh /apps/deepfabric
WORKDIR /root/go/src/github.com/deepfabric/elasticell-proxy

RUN chmod +x /apps/deepfabric/redis-proxy \
&& chmod +x /apps/deepfabric/entrypoint.sh
RUN make proxy

ENV ELASTICELL_HOME=/apps/deepfabric
ENV ELASTICELL_EXEC=redis-proxy
FROM alpine:latest

WORKDIR /apps/deepfabric
COPY --from=builder /root/go/src/github.com/deepfabric/elasticell-proxy/dist/redis-proxy /usr/local/bin/redis-proxy

ENTRYPOINT ["/bin/sh", "./entrypoint.sh"]
RUN mkdir -p /var/redis-proxy/
RUN mkdir -p /var/lib/redis-proxy/

# Alpine Linux doesn't use pam, which means that there is no /etc/nsswitch.conf,
# but Golang relies on /etc/nsswitch.conf to check the order of DNS resolving
# (see https://github.com/golang/go/commit/9dee7771f561cf6aee081c0af6658cc81fac3918)
# To fix this we just create /etc/nsswitch.conf and add the following line:
RUN echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' >> /etc/nsswitch.conf

# Define default command.
ENTRYPOINT ["/usr/local/bin/redis-proxy"]
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ DIST_DIR = $(ROOT_DIR)dist/
release: dist_dir pd cell;

.PHONY: pd
taas: ; $(info ======== compiled elasticell-pd:)
pd: ; $(info ======== compiled elasticell-pd:)
env CGO_ENABLED=$(CGO_ENABLED) GOOS=$(GOOS) go build -a -installsuffix cgo -o $(DIST_DIR)pd $(LD_FLAGS) $(ROOT_DIR)cmd/pd/*.go

.PHONY: cell
taas: ; $(info ======== compiled elasticell-cell:)
cell: ; $(info ======== compiled elasticell-cell:)
env GOOS=$(GOOS) go build -o $(DIST_DIR)cell $(LD_FLAGS) $(ROOT_DIR)cmd/cell/*.go

.PHONY: dist_dir
Expand Down
87 changes: 0 additions & 87 deletions entrypoint-build.sh

This file was deleted.

6 changes: 0 additions & 6 deletions entrypoint.sh

This file was deleted.

0 comments on commit 73e8455

Please sign in to comment.