forked from mystiq/dex
Adding architecture support for arm/arm64/amd64 docker images (#1781)
add multi-arch image support for armv7/arm64/amd64 architectures
This commit is contained in:
parent
c64ff34d11
commit
549b67bccd
3 changed files with 106 additions and 22 deletions
51
.github/workflows/ci.yml
vendored
51
.github/workflows/ci.yml
vendored
|
@ -90,20 +90,53 @@ jobs:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Determine tag
|
- name: Get Version
|
||||||
|
id: info
|
||||||
|
run: |
|
||||||
|
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
||||||
|
|
||||||
|
- name: Determine Docker Tag
|
||||||
uses: haya14busa/action-cond@v1
|
uses: haya14busa/action-cond@v1
|
||||||
id: imagetag
|
id: imagetag
|
||||||
with:
|
with:
|
||||||
cond: ${{ github.event_name == 'pull_request' }}
|
cond: ${{ github.event_name == 'pull_request' }}
|
||||||
if_true: ${{ github.sha }}
|
if_true: ${{ github.sha }}
|
||||||
if_false: "master"
|
if_false: 'master'
|
||||||
|
|
||||||
- name: Build
|
- name: Set up QEMU
|
||||||
uses: docker/build-push-action@v1
|
uses: docker/setup-qemu-action@v1
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
platforms: all
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
repository: dexidp/dex
|
- name: Set up Docker Buildx
|
||||||
tags: ${{ steps.imagetag.outputs.value }}
|
id: buildx
|
||||||
add_git_labels: true
|
uses: docker/setup-buildx-action@v1
|
||||||
|
with:
|
||||||
|
install: true
|
||||||
|
version: latest
|
||||||
|
# TODO: Remove driver-opts once fix is released docker/buildx#386
|
||||||
|
driver-opts: image=moby/buildkit:master
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Build and Push
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: Dockerfile
|
||||||
|
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||||
push: ${{ github.event_name == 'push' }}
|
push: ${{ github.event_name == 'push' }}
|
||||||
|
tags: dexidp/dex:${{ steps.imagetag.outputs.value }}
|
||||||
|
labels: |
|
||||||
|
org.opencontainers.image.title=${{ github.event.repository.name }}
|
||||||
|
org.opencontainers.image.description=${{ github.event.repository.description }}
|
||||||
|
org.opencontainers.image.url=${{ github.event.repository.html_url }}
|
||||||
|
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
|
||||||
|
org.opencontainers.image.version=${{ steps.imagetag.outputs.value }}
|
||||||
|
org.opencontainers.image.created=${{ steps.info.outputs.created }}
|
||||||
|
org.opencontainers.image.revision=${{ github.sha }}
|
||||||
|
org.opencontainers.image.licenses=${{ github.event.repository.license.spdx_id }}
|
||||||
|
|
55
.github/workflows/release.yml
vendored
55
.github/workflows/release.yml
vendored
|
@ -3,7 +3,7 @@ name: Release
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- "v[0-9]+.[0-9]+.[0-9]+"
|
- 'v[0-9]+.[0-9]+.[0-9]+'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker:
|
docker:
|
||||||
|
@ -13,12 +13,49 @@ jobs:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Build and push image
|
- name: Get Version
|
||||||
uses: docker/build-push-action@v1
|
id: info
|
||||||
|
run: |
|
||||||
|
VERSION=$(shell ./scripts/git-version)
|
||||||
|
echo ::set-output name=version::${VERSION}
|
||||||
|
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v1
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
platforms: all
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
repository: dexidp/dex
|
- name: Set up Docker Buildx
|
||||||
tags: latest
|
id: buildx
|
||||||
tag_with_ref: true
|
uses: docker/setup-buildx-action@v1
|
||||||
add_git_labels: true
|
with:
|
||||||
|
install: true
|
||||||
|
version: latest
|
||||||
|
# TODO: Remove driver-opts once fix is released docker/buildx#386
|
||||||
|
driver-opts: image=moby/buildkit:master
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Build and Push
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: Dockerfile
|
||||||
|
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
dexidp/dex:latest
|
||||||
|
dexidp/dex:${{ steps.info.outputs.version }}
|
||||||
|
labels: |
|
||||||
|
org.opencontainers.image.title=${{ github.event.repository.name }}
|
||||||
|
org.opencontainers.image.description=${{ github.event.repository.description }}
|
||||||
|
org.opencontainers.image.url=${{ github.event.repository.html_url }}
|
||||||
|
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
|
||||||
|
org.opencontainers.image.version=${{ steps.info.outputs.version }}
|
||||||
|
org.opencontainers.image.created=${{ steps.info.outputs.created }}
|
||||||
|
org.opencontainers.image.revision=${{ github.sha }}
|
||||||
|
org.opencontainers.image.licenses=${{ github.event.repository.license.spdx_id }}
|
||||||
|
|
22
Dockerfile
22
Dockerfile
|
@ -1,11 +1,25 @@
|
||||||
FROM golang:1.14-alpine
|
FROM golang:1.14-alpine
|
||||||
|
|
||||||
|
ARG TARGETOS
|
||||||
|
ARG TARGETARCH
|
||||||
|
ARG TARGETVARIANT=""
|
||||||
|
|
||||||
|
WORKDIR /go/src/github.com/dexidp/dex
|
||||||
|
|
||||||
|
ENV GOOS=${TARGETOS} \
|
||||||
|
GOARCH=${TARGETARCH} \
|
||||||
|
GOARM=${TARGETVARIANT}
|
||||||
|
|
||||||
RUN apk add --no-cache --update alpine-sdk
|
RUN apk add --no-cache --update alpine-sdk
|
||||||
|
|
||||||
COPY . /go/src/github.com/dexidp/dex
|
COPY . .
|
||||||
RUN cd /go/src/github.com/dexidp/dex && make release-binary
|
|
||||||
|
RUN make release-binary
|
||||||
|
|
||||||
FROM alpine:3.12
|
FROM alpine:3.12
|
||||||
|
|
||||||
|
WORKDIR /
|
||||||
|
|
||||||
# Dex connectors, such as GitHub and Google logins require root certificates.
|
# Dex connectors, such as GitHub and Google logins require root certificates.
|
||||||
# Proper installations should manage those certificates, but it's a bad user
|
# Proper installations should manage those certificates, but it's a bad user
|
||||||
# experience when this doesn't work out of the box.
|
# experience when this doesn't work out of the box.
|
||||||
|
@ -14,12 +28,12 @@ FROM alpine:3.12
|
||||||
RUN apk add --update ca-certificates openssl
|
RUN apk add --update ca-certificates openssl
|
||||||
|
|
||||||
USER 1001:1001
|
USER 1001:1001
|
||||||
|
|
||||||
COPY --from=0 /go/bin/dex /usr/local/bin/dex
|
COPY --from=0 /go/bin/dex /usr/local/bin/dex
|
||||||
|
|
||||||
# Import frontend assets and set the correct CWD directory so the assets
|
# Import frontend assets and set the correct CWD directory so the assets
|
||||||
# are in the default path.
|
# are in the default path.
|
||||||
COPY web /web
|
COPY web .
|
||||||
WORKDIR /
|
|
||||||
|
|
||||||
ENTRYPOINT ["dex"]
|
ENTRYPOINT ["dex"]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue