diff --git a/Dockerfile b/Dockerfile index 1316d62..07eab21 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,18 @@ # vim: ft=dockerfile -FROM golang +FROM golang:alpine MAINTAINER Jimmy Zelinskie -# Add files +# Create source directory WORKDIR /go/src/github.com/chihaya/chihaya/ RUN mkdir -p /go/src/github.com/chihaya/chihaya/ -# Dependencies +# Install dependencies +RUN apk update && apk add git RUN go get github.com/tools/godep ADD Godeps /go/src/github.com/chihaya/chihaya/Godeps RUN godep restore -# Add source +# Add source files ADD *.go /go/src/github.com/chihaya/chihaya/ ADD api /go/src/github.com/chihaya/chihaya/api ADD cmd /go/src/github.com/chihaya/chihaya/cmd @@ -20,14 +21,13 @@ ADD http /go/src/github.com/chihaya/chihaya/http ADD stats /go/src/github.com/chihaya/chihaya/stats ADD tracker /go/src/github.com/chihaya/chihaya/tracker ADD udp /go/src/github.com/chihaya/chihaya/udp +ADD example_config.json /config.json -# Install +# Install chihaya RUN go install github.com/chihaya/chihaya/cmd/chihaya -# Configuration/environment -VOLUME ["/config"] +# Setup the entrypoint +# docker run -p 6880-6882:6880-6882 -v $PATH_TO_CONFIG_FILE:/config.json:ro quay.io/jzelinskie/chihaya:latest -v=5 EXPOSE 6880-6882 - -# docker run -p 6880-6882:6880-6882 -v $PATH_TO_DIR_WITH_CONF_FILE:/config:ro -e quay.io/jzelinskie/chihaya:latest -v=5 -ENTRYPOINT ["chihaya", "-config=/config/config.json", "-logtostderr=true"] +ENTRYPOINT ["chihaya", "-config=/config.json", "-logtostderr=true"] CMD ["-v=5"] diff --git a/README.md b/README.md index fc109b2..aa39c0a 100644 --- a/README.md +++ b/README.md @@ -50,12 +50,12 @@ An explanation of the available keys can be found in [CONFIGURATION.md]. ### Docker ```sh -# Create a config directory and download the example config -mkdir $HOME/chihaya-config -curl -L https://raw.githubusercontent.com/chihaya/chihaya/release-v1.0/example_config.json -o $HOME/chihaya-config/config.json +# Download and edit the example config +curl -L https://raw.githubusercontent.com/chihaya/chihaya/release-v1.0/example_config.json -o config.json +vi config.json -# Run the container with the config directory mounted -docker run -p 6880-6882:6880-6882 -v $HOME/chihaya-config:/config:ro quay.io/jzelinskie/chihaya:v1.0.0 -v=5 +# Run the container with the config file mounted +docker run -p 6880-6882:6880-6882 -v $PWD/config.json:/config.json:ro quay.io/jzelinskie/chihaya:v1.0.1 -v=5 ``` ## Developing Chihaya