Skip to content

Commit

Permalink
Change Dockerfile to multi stage build
Browse files Browse the repository at this point in the history
  • Loading branch information
haxorof committed Sep 24, 2017
1 parent ed9cb86 commit 8121a6a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 35 deletions.
30 changes: 9 additions & 21 deletions Dockerfile
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"]
14 changes: 0 additions & 14 deletions Dockerfile.multi

This file was deleted.

0 comments on commit 8121a6a

Please sign in to comment.