Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding architecture support for arm/arm64/amd64 docker images #1781

Merged
merged 3 commits into from
Sep 27, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 27 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,38 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Determine tag
- name: Determine Docker Tag
uses: haya14busa/action-cond@v1
id: imagetag
with:
cond: ${{ github.event_name == 'pull_request' }}
if_true: ${{ github.sha }}
if_false: "master"
if_false: 'master'

- name: Build
uses: docker/build-push-action@v1
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: dexidp/dex
tags: ${{ steps.imagetag.outputs.value }}
add_git_labels: true
platforms: all

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
install: true
version: latest
driver-opts: image=moby/buildkit:master
xunholy marked this conversation as resolved.
Show resolved Hide resolved

- 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' }}
tags: dexidp/dex:${{ steps.imagetag.outputs.value }}
45 changes: 36 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- 'v[0-9]+.[0-9]+.[0-9]+'

jobs:
docker:
Expand All @@ -13,12 +13,39 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Build and push image
uses: docker/build-push-action@v1
- name: Get Version
id: info
run: |
VERSION=$(shell ./scripts/git-version)
echo ::set-output name=version::${VERSION}

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: all

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
install: true
version: latest
driver-opts: image=moby/buildkit:master
xunholy marked this conversation as resolved.
Show resolved Hide resolved

- 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:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: dexidp/dex
tags: latest
tag_with_ref: true
add_git_labels: true
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm64
push: true
tags: |
dexidp/dex:latest
xunholy marked this conversation as resolved.
Show resolved Hide resolved
dexidp/dex:${{ steps.info.outputs.version }}

22 changes: 18 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
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

COPY . /go/src/github.com/dexidp/dex
RUN cd /go/src/github.com/dexidp/dex && make release-binary
COPY . .

RUN make release-binary

FROM alpine:3.12

WORKDIR /

# Dex connectors, such as GitHub and Google logins require root certificates.
# Proper installations should manage those certificates, but it's a bad user
# experience when this doesn't work out of the box.
Expand All @@ -14,12 +28,12 @@ FROM alpine:3.12
RUN apk add --update ca-certificates openssl

USER 1001:1001

COPY --from=0 /go/bin/dex /usr/local/bin/dex

# Import frontend assets and set the correct CWD directory so the assets
# are in the default path.
COPY web /web
WORKDIR /
COPY web .

ENTRYPOINT ["dex"]

Expand Down