Skip to content

Commit 50a1c37

Browse files
authored
Update Dockerfile for new build process (#74)
Update the Dockerfile based on the new build process. Use the crossbuild style Dockerfile to allow for easier multi-arch Docker images. Update CircleCI build and release to use orb template. Fixes: #73 Signed-off-by: Ben Kochie <[email protected]>
1 parent da866ec commit 50a1c37

File tree

2 files changed

+24
-39
lines changed

2 files changed

+24
-39
lines changed

.circleci/config.yml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,6 @@ jobs:
3737
name: Run everything and test that Prometheus can scrape node_exporter via pushprox
3838
command: ./end-to-end-test.sh
3939

40-
publish_release:
41-
executor: golang
42-
43-
steps:
44-
- prometheus/setup_build_environment
45-
- run: promu crossbuild tarballs
46-
- run: promu checksum .tarballs
47-
- run: promu release .tarballs
48-
- store_artifacts:
49-
path: .tarballs
50-
destination: releases
51-
5240
workflows:
5341
version: 2
5442
stuff:
@@ -62,7 +50,15 @@ workflows:
6250
filters:
6351
tags:
6452
only: /.*/
65-
- publish_release:
53+
- prometheus/publish_master:
54+
context: org-context
55+
requires:
56+
- test
57+
- build
58+
filters:
59+
branches:
60+
only: master
61+
- prometheus/publish_release:
6662
context: org-context
6763
requires:
6864
- test

Dockerfile

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,15 @@
1-
FROM alpine:latest as certificates
2-
RUN apk update && apk add --no-cache ca-certificates && update-ca-certificates
3-
4-
FROM golang:1.12 as builder
5-
6-
RUN go get github.com/robustperception/pushprox/proxy
7-
WORKDIR $GOPATH/src/github.com/robustperception/pushprox/proxy
8-
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build
9-
10-
RUN go get github.com/robustperception/pushprox/client
11-
WORKDIR $GOPATH/src/github.com/robustperception/pushprox/client
12-
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build
13-
14-
15-
FROM scratch
16-
17-
# Copy certs from alpine as they don't exist from scratch
18-
COPY --from=certificates /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
19-
20-
# Copy client and proxy from builder
21-
COPY --from=builder /go/src/github.com/robustperception/pushprox/proxy /app
22-
COPY --from=builder /go/src/github.com/robustperception/pushprox/client /app
23-
24-
# default startup is the proxy.
25-
# Can be overridden with the docker --entrypoint flag, or the command field in Kubernetes container v1 API
26-
ENTRYPOINT ["/app/proxy"]
1+
# Requires `promu crossbuild` artifacts.
2+
ARG ARCH="amd64"
3+
ARG OS="linux"
4+
FROM quay.io/prometheus/busybox-${OS}-${ARCH}:glibc
5+
6+
ARG ARCH="amd64"
7+
ARG OS="linux"
8+
COPY .build/${OS}-${ARCH}/pushprox-proxy /bin/pushprox-proxy
9+
COPY .build/${OS}-${ARCH}/pushprox-client /bin/pushprox-client
10+
11+
# The default startup is the proxy.
12+
# This can be overridden with the docker --entrypoint flag or the command
13+
# field in Kubernetes container v1 API.
14+
USER nobody
15+
ENTRYPOINT ["/app/pushprox-proxy"]

0 commit comments

Comments
 (0)