Skip to content

Commit

Permalink
setcap dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
schallert committed Jul 25, 2019
1 parent 2b1147a commit 09c732a
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 12 deletions.
28 changes: 16 additions & 12 deletions docker/images.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
{
"images": {
"m3aggregator": {
"dockerfile": "docker/m3aggregator/Dockerfile",
"name": "m3aggregator"
},
"m3coordinator": {
"dockerfile": "docker/m3coordinator/Dockerfile",
"name": "m3coordinator"
},
"m3dbnode": {
"name": "m3dbnode",
"dockerfile": "docker/m3dbnode/Dockerfile"
"dockerfile": "docker/m3dbnode/Dockerfile",
"name": "m3dbnode"
},
"m3dbnode-setcap": {
"dockerfile": "docker/m3dbnode/Dockerfile-setcap",
"name": "m3dbnode",
"dockerfile": "docker/m3dbnode/Dockerfile",
"tag_suffix": "setcap"
},
"m3coordinator": {
"name": "m3coordinator",
"dockerfile": "docker/m3coordinator/Dockerfile"
"m3nsch": {
"dockerfile": "docker/m3nsch/Dockerfile",
"name": "m3nsch"
},
"m3query": {
"name": "m3query",
"dockerfile": "docker/m3query/Dockerfile"
},
"m3nsch": {
"name": "m3nsch",
"dockerfile": "docker/m3nsch/Dockerfile"
"dockerfile": "docker/m3query/Dockerfile",
"name": "m3query"
}
}
}
34 changes: 34 additions & 0 deletions docker/m3dbnode/Dockerfile-setcap
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# stage 1: build
FROM golang:1.12-alpine AS builder
LABEL maintainer="The M3DB Authors <[email protected]>"

# Install Glide
RUN apk add --update glide git make bash

# Add source code
RUN mkdir -p /go/src/github.com/m3db/m3
ADD . /go/src/github.com/m3db/m3

# Build m3dbnode binary
RUN cd /go/src/github.com/m3db/m3/ && \
git submodule update --init && \
make m3dbnode-linux-amd64

# Stage 2: lightweight "release"
FROM alpine:latest
LABEL maintainer="The M3DB Authors <[email protected]>"

EXPOSE 2379/tcp 2380/tcp 7201/tcp 7203/tcp 9000-9004/tcp

COPY --from=builder /go/src/github.com/m3db/m3/src/dbnode/config/m3dbnode-local-etcd.yml /etc/m3dbnode/m3dbnode.yml
COPY --from=builder /go/src/github.com/m3db/m3/bin/m3dbnode \
/go/src/github.com/m3db/m3/scripts/m3dbnode_bootstrapped.sh \
/bin/

# Use setcap to set +e "effective" and +p "permitted" to adjust the SYS_RESOURCE
# so the process can raise the hard file limit with setrlimit.
RUN apk add --no-cache curl jq libcap && \
setcap cap_sys_resource=+ep /bin/m3dbnode

ENTRYPOINT [ "/bin/m3dbnode" ]
CMD [ "-f", "/etc/m3dbnode/m3dbnode.yml" ]

0 comments on commit 09c732a

Please sign in to comment.