Skip to content

Commit b6c3074

Browse files
committed
Replace docker-build script with multi-stage build
1 parent 64c97c7 commit b6c3074

File tree

4 files changed

+11
-32
lines changed

4 files changed

+11
-32
lines changed

.dockerignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
*
2-
!_output/bin
3-
!web
1+
bin

Dockerfile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
1-
FROM alpine:3.4
1+
FROM golang:1.8.3-alpine
22

33
MAINTAINER Ed Rooth <[email protected]>
44
MAINTAINER Lucas Servén <[email protected]>
55
MAINTAINER Rithu John <[email protected]>
66

7+
RUN apk add --no-cache --update alpine-sdk
8+
9+
COPY . /go/src/github.com/coreos/dex
10+
RUN cd /go/src/github.com/coreos/dex && make release-binary
11+
12+
FROM alpine:3.4
713
# Dex connectors, such as GitHub and Google logins require root certificates.
814
# Proper installations should manage those certificates, but it's a bad user
915
# experience when this doesn't work out of the box.
1016
#
1117
# OpenSSL is required so wget can query HTTPS endpoints for health checking.
1218
RUN apk add --update ca-certificates openssl
1319

14-
COPY _output/bin/dex /usr/local/bin/dex
20+
COPY --from=0 /go/bin/dex /usr/local/bin/dex
1521

1622
# Import frontend assets and set the correct CWD directory so the assets
1723
# are in the default path.

Makefile

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ DOCKER_REPO=quay.io/coreos/dex
99
DOCKER_IMAGE=$(DOCKER_REPO):$(VERSION)
1010

1111
$( shell mkdir -p bin )
12-
$( shell mkdir -p _output/images )
13-
$( shell mkdir -p _output/bin )
1412

1513
user=$(shell id -u -n)
1614
group=$(shell id -g -n)
@@ -58,12 +56,8 @@ lint:
5856
golint -set_exit_status $$package $$i || exit 1; \
5957
done
6058

61-
_output/bin/dex:
62-
@./scripts/docker-build
63-
@sudo chown $(user):$(group) _output/bin/dex
64-
6559
.PHONY: docker-image
66-
docker-image: clean-release _output/bin/dex
60+
docker-image:
6761
@sudo docker build -t $(DOCKER_IMAGE) .
6862

6963
.PHONY: proto
@@ -85,13 +79,9 @@ bin/protoc-gen-go:
8579
check-go-version:
8680
@./scripts/check-go-version
8781

88-
clean: clean-release
82+
clean:
8983
@rm -rf bin/
9084

91-
.PHONY: clean-release
92-
clean-release:
93-
@rm -rf _output/
94-
9585
testall: testrace vet fmt lint
9686

9787
FORCE:

scripts/docker-build

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

0 commit comments

Comments
 (0)