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

Commit 4846313

Browse files
authored
feat: automated docker image build with multi arch (amd64 + arm64) (#665)
* feat: build container in ci Signed-off-by: Markus Maga <[email protected]> * chore: add dependabot config Signed-off-by: Markus Maga <[email protected]>
1 parent 472ad25 commit 4846313

File tree

3 files changed

+70
-1
lines changed

3 files changed

+70
-1
lines changed

.github/.dependabot.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
updates:
3+
# Maintain dependencies for GitHub Actions
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "daily"
+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: docker
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
tags:
8+
- '*.*.*'
9+
pull_request:
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v2
17+
18+
- name: Set up QEMU
19+
uses: docker/setup-qemu-action@v1
20+
21+
- name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v1
23+
24+
- name: Image name
25+
id: image_name
26+
uses: actions/github-script@v3
27+
with:
28+
github-token: ${{secrets.GITHUB_TOKEN}}
29+
script: |
30+
const { default_branch } = await github.repos.get(context.repo);
31+
32+
let imageName = 'kes-dev';
33+
34+
if (default_branch === context.ref.replace('refs/heads/', '') || context.ref.startsWith('refs/tags/')) {
35+
imageName = 'kubernetes-external-secrets';
36+
}
37+
38+
core.setOutput('image', `ghcr.io/external-secrets/${imageName}`);
39+
40+
- name: Docker meta
41+
id: docker_meta
42+
uses: crazy-max/ghaction-docker-meta@v1
43+
with:
44+
images: ${{ steps.image_name.outputs.image }}
45+
tag-sha: github.ref != 'refs/heads/master'
46+
47+
- name: Login to Docker
48+
uses: docker/login-action@v1
49+
with:
50+
registry: ghcr.io
51+
username: ${{ secrets.GHCR_USERNAME }}
52+
password: ${{ secrets.GHCR_TOKEN }}
53+
54+
- name: Build and push
55+
uses: docker/build-push-action@v2
56+
with:
57+
context: .
58+
platforms: linux/amd64,linux/arm64
59+
push: true
60+
tags: ${{ steps.docker_meta.outputs.tags }}
61+
labels: ${{ steps.docker_meta.outputs.labels }}
62+

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM node:12-alpine
22

33
ENV NODE_ENV production
4-
ENV NPM_CONFIG_LOGLEVEL info
4+
ENV NPM_CONFIG_LOGLEVEL warn
55

66
# Setup source directory
77
WORKDIR /app

0 commit comments

Comments
 (0)