Skip to content
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.

Commit

Permalink
feat: automated docker image build with multi arch (amd64 + arm64) (#665
Browse files Browse the repository at this point in the history
)

* feat: build container in ci

Signed-off-by: Markus Maga <[email protected]>

* chore: add dependabot config

Signed-off-by: Markus Maga <[email protected]>
  • Loading branch information
Flydiverny authored Mar 18, 2021
1 parent 472ad25 commit 4846313
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .github/.dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
62 changes: 62 additions & 0 deletions .github/workflows/build-container.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: docker

on:
push:
branches:
- '**'
tags:
- '*.*.*'
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

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

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Image name
id: image_name
uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const { default_branch } = await github.repos.get(context.repo);
let imageName = 'kes-dev';
if (default_branch === context.ref.replace('refs/heads/', '') || context.ref.startsWith('refs/tags/')) {
imageName = 'kubernetes-external-secrets';
}
core.setOutput('image', `ghcr.io/external-secrets/${imageName}`);
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: ${{ steps.image_name.outputs.image }}
tag-sha: github.ref != 'refs/heads/master'

- name: Login to Docker
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM node:12-alpine

ENV NODE_ENV production
ENV NPM_CONFIG_LOGLEVEL info
ENV NPM_CONFIG_LOGLEVEL warn

# Setup source directory
WORKDIR /app
Expand Down

0 comments on commit 4846313

Please sign in to comment.