Skip to content

Commit

Permalink
Add dockerfile to examples (m3db#639)
Browse files Browse the repository at this point in the history
* Adding Dockerfile to lower the barrier for build and packaging m3dbnode

* Removing invalid configurations

* More configuration edits

* Adding kuberneters POD manifest

* More configuration changes

* Adding fake repository

* Adding fake repository

* Correct entrypoint string

* Correct entrypoint string

* ensure correct proto for exposed ports

* Adding Dockerfile to lower the barrier for build and packaging m3dbnode

* Removing invalid configurations

* More configuration edits

* Adding kuberneters POD manifest

* More configuration changes

* Adding fake repository

* Correct entrypoint string

* renaming configuraiton file from yaml to yml

* Addressing PR comments
  • Loading branch information
nerd0 authored May 17, 2018
1 parent fff6b14 commit 900d4de
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 24 deletions.
13 changes: 9 additions & 4 deletions example/m3db-node-config.yaml → config/m3dbnode.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
logging:
level: info
level: debug

metrics:
prometheus:
handlerPath: /metrics
sanitization: prometheus
samplingRate: 1.0
extended: detailed
prometheus:
handlerPath: /metrics
m3:
hostPort: 127.0.0.1:9052
service: m3dbnode
env: production
includeHost: true

listenAddress: 0.0.0.0:9000
clusterListenAddress: 0.0.0.0:9001
Expand Down Expand Up @@ -182,7 +187,7 @@ config:
replicas: 1
hosts:
- hostID: m3db_server
listenAddress: "127.0.0.1:9000"
listenAddress: "0.0.0.0:9000"
namespaces:
- id: metrics
retention:
Expand Down
22 changes: 22 additions & 0 deletions docker/Dockerfile-dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM golang:1.10-alpine

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

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

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

EXPOSE 9000/tcp
EXPOSE 9001/tcp
EXPOSE 9002/tcp
EXPOSE 9003/tcp
EXPOSE 9004/tcp

ENTRYPOINT ["/go/src/github.com/m3db/m3db/bin/m3dbnode", "-f", "/go/src/github.com/m3db/m3db/config/m3dbnode.yml"]
13 changes: 13 additions & 0 deletions docker/Dockerfile-release
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM apline:3.7

COPY bin/m3dbnode /bin/m3dbnode
RUN mkdir -p /etc/m3/
COPY config/m3dbnode.yml /etc/m3/m3dbnode.yml

EXPOSE 9000/tcp
EXPOSE 9001/tcp
EXPOSE 9002/tcp
EXPOSE 9003/tcp
EXPOSE 9004/tcp

ENTRYPOINT ["/bin/m3dbnode", "-f", "/etc/m3/m3dbnode.yml"]
24 changes: 24 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# M3DB Docker build processes

## Development building and testing

The `Dockerfile-dev` file is intented to help bootstrap the development
process by providing a simple Dockerfile to perform the build process within
a container namespace. Docker's container runtime also provides simple way to
simulate production like environment.

```
docker build -t m3dbnode:latest -f Dockerfile-dev .
docker run --name m3dbnode m3dbnode:latest
```

## Production building and release

The `Dockerfile-release` file is intented to provide the Docker image used within a
production environment in which the minimal amount of artifacts are placed
within the container.

```
docker build -t m3dbnode:$(git rev-parse head) -f Dockerfile-release .
docker run --name m3dbnode m3dbnode:$(git rev-parse head)
```
20 changes: 0 additions & 20 deletions example/README.md

This file was deleted.

27 changes: 27 additions & 0 deletions kubernetes/m3dbnode-pod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: v1
kind: Pod
metadata:
labels:
app: m3dbnode
name: m3dbnode01
spec:
containers:
- command:
- /go/src/github.com/m3db/m3db/bin/m3dbnode
- -f
- /go/src/github.com/m3db/m3db/config/m3dbnode.yml
image: <insert_image_repository_address>/<image_name>:<image_tag>
name: m3dbnode01
ports:
- containerPort: 9000
name: client
protocol: TCP
- containerPort: 9001
name: cluster
protocol: TCP
- containerPort: 9002
name: http-client
protocol: TCP
- containerPort: 9003
name: debug
protocol: TCP

0 comments on commit 900d4de

Please sign in to comment.