diff --git a/Dockerfile b/Dockerfile index 17bcf33..d3f6171 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,18 @@ -FROM alpine:3.5 +FROM frolvlad/alpine-glibc:alpine-3.5 -COPY ./dist/linux-amd64/prometheus-sql / +ARG PROMETHEUS_SQL_VERSION=1.0.0 +ARG BASE_URL=https://github.com/chop-dbhi/prometheus-sql/releases/download/$PROMETHEUS_SQL_VERSION +ARG OS_ARCH=linux-amd64 +ARG ZIP_FILE=prometheus-sql-${OS_ARCH}.zip + +ADD $BASE_URL/$ZIP_FILE /tmp/ +RUN unzip /tmp/$ZIP_FILE -d /tmp \ + && cp /tmp/$OS_ARCH/* /usr/local/bin/ \ + && rm -rf /tmp/* EXPOSE 8080 -ENTRYPOINT ["/prometheus-sql", "-host", "0.0.0.0"] +ENTRYPOINT ["/usr/local/bin/prometheus-sql", "-host", "0.0.0.0"] # Default command assumes the SQL agent is linked. -CMD ["-service", "http://sqlagent:5000"] +CMD ["-service", "http://sqlagent:5000"] \ No newline at end of file diff --git a/README.md b/README.md index bdbaf25..74cf1b2 100644 --- a/README.md +++ b/README.md @@ -88,20 +88,20 @@ Alternately, use the `docker-compose.yml` file included in this repository. The ## How To Build -### Build distribution binaries +### Build distribution packages -This section describes how you build prometheus-sql distribution binaries. +This section describes how you build prometheus-sql distribution packages. -1. Build prometheus-sql binaries for several platforms: +1. Build prometheus-sql packages for several platforms: Using Make: ```bash - make prepare dist-build + make prepare dist ``` Using Docker: ```bash - docker run --rm -v ${PWD}:/go/bin -v ${PWD}:/usr/src/myapp -w /usr/src/myapp golang:1.8 bash -c 'make prepare dist-build' + docker run --rm -v ${PWD}:/go/bin -v ${PWD}:/usr/src/myapp -w /usr/src/myapp golang:1.8 bash -c 'apt-get update && apt-get -y install zip && make prepare dist' ``` 1. All binaries produced are now located in directories under the `dist` directory.