-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change Dockerfile to multi stage build
- Loading branch information
Showing
2 changed files
with
9 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,14 @@ | ||
FROM frolvlad/alpine-glibc:alpine-3.5 | ||
|
||
ARG PROMETHEUS_SQL_VERSION=1.2.0 | ||
ARG PKG_FILE=prometheus-sql-linux-amd64.tar.gz | ||
ARG PKG_URL=https://github.com/chop-dbhi/prometheus-sql/releases/download/$PROMETHEUS_SQL_VERSION/$PKG_FILE | ||
|
||
RUN apk update | ||
RUN apk add curl | ||
|
||
# Workaround to publish Github release before curl fetches it. | ||
RUN sleep 60 | ||
|
||
RUN mkdir -p /opt/prometheus-sql/bin \ | ||
&& curl --retry 5 --retry-delay 15 --retry-max-time 120 -SL $PKG_URL \ | ||
| tar -xzC /opt/prometheus-sql/bin \ | ||
&& ln -s /opt/prometheus-sql/bin/linux-amd64/prometheus-sql /usr/local/bin/ | ||
|
||
RUN apk del curl | ||
RUN rm /var/cache/apk/* | ||
# Requires Docker v17.06 or later | ||
FROM golang:1.8.3 as builder | ||
RUN mkdir -p /go/src/app | ||
WORKDIR /go/src/app | ||
COPY . /go/src/app | ||
RUN go-wrapper download | ||
RUN go-wrapper install | ||
|
||
FROM frolvlad/alpine-glibc:alpine-3.5 | ||
COPY --from=builder /go/bin/app /usr/local/bin/prometheus-sql | ||
EXPOSE 8080 | ||
|
||
ENTRYPOINT ["/usr/local/bin/prometheus-sql", "-host", "0.0.0.0"] | ||
|
||
# Default command assumes the SQL agent is linked. | ||
CMD ["-service", "http://sqlagent:5000"] |
This file was deleted.
Oops, something went wrong.