Skip to content

Commit 8121a6a

Browse files
committed
Change Dockerfile to multi stage build
1 parent ed9cb86 commit 8121a6a

File tree

2 files changed

+9
-35
lines changed

2 files changed

+9
-35
lines changed

Dockerfile

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,14 @@
1-
FROM frolvlad/alpine-glibc:alpine-3.5
2-
3-
ARG PROMETHEUS_SQL_VERSION=1.2.0
4-
ARG PKG_FILE=prometheus-sql-linux-amd64.tar.gz
5-
ARG PKG_URL=https://github.com/chop-dbhi/prometheus-sql/releases/download/$PROMETHEUS_SQL_VERSION/$PKG_FILE
6-
7-
RUN apk update
8-
RUN apk add curl
9-
10-
# Workaround to publish Github release before curl fetches it.
11-
RUN sleep 60
12-
13-
RUN mkdir -p /opt/prometheus-sql/bin \
14-
&& curl --retry 5 --retry-delay 15 --retry-max-time 120 -SL $PKG_URL \
15-
| tar -xzC /opt/prometheus-sql/bin \
16-
&& ln -s /opt/prometheus-sql/bin/linux-amd64/prometheus-sql /usr/local/bin/
17-
18-
RUN apk del curl
19-
RUN rm /var/cache/apk/*
1+
# Requires Docker v17.06 or later
2+
FROM golang:1.8.3 as builder
3+
RUN mkdir -p /go/src/app
4+
WORKDIR /go/src/app
5+
COPY . /go/src/app
6+
RUN go-wrapper download
7+
RUN go-wrapper install
208

9+
FROM frolvlad/alpine-glibc:alpine-3.5
10+
COPY --from=builder /go/bin/app /usr/local/bin/prometheus-sql
2111
EXPOSE 8080
22-
2312
ENTRYPOINT ["/usr/local/bin/prometheus-sql", "-host", "0.0.0.0"]
24-
2513
# Default command assumes the SQL agent is linked.
2614
CMD ["-service", "http://sqlagent:5000"]

Dockerfile.multi

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)