Merge pull request #37 from kskewes/dockerarm
feat(arm): Cross build arm and arm64 docker images
This commit is contained in:
commit
92c4424639
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,6 +1,7 @@
|
|||||||
oauth2_proxy
|
oauth2_proxy
|
||||||
vendor
|
vendor
|
||||||
dist
|
dist
|
||||||
|
release
|
||||||
.godeps
|
.godeps
|
||||||
*.exe
|
*.exe
|
||||||
.env
|
.env
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
- After a successful login, you will be redirected to your original URL rather than /
|
- After a successful login, you will be redirected to your original URL rather than /
|
||||||
- [#35](https://github.com/pusher/oauth2_proxy/pull/35) arm and arm64 binary releases (@kskewes)
|
- [#35](https://github.com/pusher/oauth2_proxy/pull/35) arm and arm64 binary releases (@kskewes)
|
||||||
- Add armv6 and arm64 to Makefile `release` target
|
- Add armv6 and arm64 to Makefile `release` target
|
||||||
|
- [#37](https://github.com/pusher/oauth2_proxy/pull/37) cross build arm and arm64 docker images (@kskewes)
|
||||||
|
|
||||||
# v3.0.0
|
# v3.0.0
|
||||||
|
|
||||||
|
@ -8,6 +8,8 @@ Download the dependencies using [`dep`](https://github.com/golang/dep).
|
|||||||
```bash
|
```bash
|
||||||
cd $GOPATH/src/github.com # Create this directory if it doesn't exist
|
cd $GOPATH/src/github.com # Create this directory if it doesn't exist
|
||||||
git clone git@github.com:<YOUR_FORK>/oauth2_proxy pusher/oauth2_proxy
|
git clone git@github.com:<YOUR_FORK>/oauth2_proxy pusher/oauth2_proxy
|
||||||
|
cd pusher/oauth2_proxy
|
||||||
|
./configure # Setup your environment variables
|
||||||
make dep
|
make dep
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ RUN ./configure && make build
|
|||||||
|
|
||||||
# Copy binary to alpine
|
# Copy binary to alpine
|
||||||
FROM alpine:3.8
|
FROM alpine:3.8
|
||||||
RUN apk add --no-cache ca-certificates
|
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||||
COPY --from=builder /go/src/github.com/pusher/oauth2_proxy/oauth2_proxy /bin/oauth2_proxy
|
COPY --from=builder /go/src/github.com/pusher/oauth2_proxy/oauth2_proxy /bin/oauth2_proxy
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/oauth2_proxy"]
|
ENTRYPOINT ["/bin/oauth2_proxy"]
|
||||||
|
22
Dockerfile.arm64
Normal file
22
Dockerfile.arm64
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
FROM golang:1.11-stretch AS builder
|
||||||
|
|
||||||
|
# Download tools
|
||||||
|
RUN wget -O $GOPATH/bin/dep https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64
|
||||||
|
RUN chmod +x $GOPATH/bin/dep
|
||||||
|
|
||||||
|
# Copy sources
|
||||||
|
WORKDIR $GOPATH/src/github.com/pusher/oauth2_proxy
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Fetch dependencies
|
||||||
|
RUN dep ensure --vendor-only
|
||||||
|
|
||||||
|
# Build binary
|
||||||
|
RUN ./configure && GOARCH=arm64 make build
|
||||||
|
|
||||||
|
# Copy binary to alpine
|
||||||
|
FROM arm64v8/alpine:3.8
|
||||||
|
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||||
|
COPY --from=builder /go/src/github.com/pusher/oauth2_proxy/oauth2_proxy /bin/oauth2_proxy
|
||||||
|
|
||||||
|
ENTRYPOINT ["/bin/oauth2_proxy"]
|
22
Dockerfile.armv6
Normal file
22
Dockerfile.armv6
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
FROM golang:1.11-stretch AS builder
|
||||||
|
|
||||||
|
# Download tools
|
||||||
|
RUN wget -O $GOPATH/bin/dep https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64
|
||||||
|
RUN chmod +x $GOPATH/bin/dep
|
||||||
|
|
||||||
|
# Copy sources
|
||||||
|
WORKDIR $GOPATH/src/github.com/pusher/oauth2_proxy
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Fetch dependencies
|
||||||
|
RUN dep ensure --vendor-only
|
||||||
|
|
||||||
|
# Build binary
|
||||||
|
RUN ./configure && GOARCH=arm GOARM=6 make build
|
||||||
|
|
||||||
|
# Copy binary to alpine
|
||||||
|
FROM arm32v6/alpine:3.8
|
||||||
|
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||||
|
COPY --from=builder /go/src/github.com/pusher/oauth2_proxy/oauth2_proxy /bin/oauth2_proxy
|
||||||
|
|
||||||
|
ENTRYPOINT ["/bin/oauth2_proxy"]
|
14
Makefile
14
Makefile
@ -45,6 +45,20 @@ build: clean $(BINARY)
|
|||||||
$(BINARY):
|
$(BINARY):
|
||||||
CGO_ENABLED=0 $(GO) build -a -installsuffix cgo -ldflags="-X main.VERSION=${VERSION}" -o $@ github.com/pusher/oauth2_proxy
|
CGO_ENABLED=0 $(GO) build -a -installsuffix cgo -ldflags="-X main.VERSION=${VERSION}" -o $@ github.com/pusher/oauth2_proxy
|
||||||
|
|
||||||
|
.PHONY: docker
|
||||||
|
docker:
|
||||||
|
docker build -f Dockerfile -t pusher/oauth2_proxy:latest .
|
||||||
|
|
||||||
|
.PHONY: docker-all
|
||||||
|
docker-all: docker
|
||||||
|
docker build -f Dockerfile -t pusher/oauth2_proxy:latest-amd64 .
|
||||||
|
docker build -f Dockerfile -t pusher/oauth2_proxy:${VERSION} .
|
||||||
|
docker build -f Dockerfile -t pusher/oauth2_proxy:${VERSION}-amd64 .
|
||||||
|
docker build -f Dockerfile.arm64 -t pusher/oauth2_proxy:latest-arm64 .
|
||||||
|
docker build -f Dockerfile.arm64 -t pusher/oauth2_proxy:${VERSION}-arm64 .
|
||||||
|
docker build -f Dockerfile.armv6 -t pusher/oauth2_proxy:latest-armv6 .
|
||||||
|
docker build -f Dockerfile.armv6 -t pusher/oauth2_proxy:${VERSION}-armv6 .
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test: dep lint
|
test: dep lint
|
||||||
$(GO) test -v -race $(go list ./... | grep -v /vendor/)
|
$(GO) test -v -race $(go list ./... | grep -v /vendor/)
|
||||||
|
Loading…
Reference in New Issue
Block a user