Skip to content

Commit

Permalink
feat: Docker multiarch
Browse files Browse the repository at this point in the history
  • Loading branch information
chuhlomin committed Oct 3, 2023
1 parent 8150a44 commit 6fb1fba
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 32 deletions.
24 changes: 5 additions & 19 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches:
- main

env:
DOCKER_IMAGE: chuhlomin/render-template

Expand All @@ -15,29 +15,15 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Login to CR
uses: docker/login-action@v2
- name: Build and push Docker image
uses: chuhlomin/actions/docker-build-push@main
with:
username: chuhlomin
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.DOCKER_IMAGE }}
tags: latest

- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
push: true
image_name: ${{ env.DOCKER_IMAGE }}
tags: |
${{ steps.meta.outputs.tags }}
${{ env.DOCKER_IMAGE }}:${{ github.sha }}
labels: ${{ steps.meta.outputs.labels }}
${{ env.DOCKER_IMAGE }}:latest
- name: Test action
uses: ./ # Uses an action in the root directory
Expand Down
19 changes: 9 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,17 @@ jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Login to CR
uses: docker/login-action@v2
with:
username: chuhlomin
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Checkout
uses: actions/checkout@v3

- name: Get the tag
id: get_tag
run: echo "tag=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT

- name: Tag & push image
run: |
docker pull ${{ env.DOCKER_IMAGE }}:${{ github.sha }}
docker tag ${{ env.DOCKER_IMAGE }}:${{ github.sha }} ${{ env.DOCKER_IMAGE }}:${{ steps.get_tag.outputs.tag }}
docker push ${{ env.DOCKER_IMAGE }}:${{ steps.get_tag.outputs.tag }}
- name: Build and push Docker image
uses: chuhlomin/actions/docker-build-push@main
with:
username: chuhlomin
password: ${{ secrets.DOCKER_PASSWORD }}
image_name: ${{ env.DOCKER_IMAGE }}
tags: ${{ env.DOCKER_IMAGE }}:${{ steps.get_tag.outputs.tag }}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.17 as build-env
FROM --platform=$BUILDPLATFORM golang:1.17 as build-env

WORKDIR /go/src/app
ADD . /go/src/app
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
- name: Render template
id: render_template
uses: chuhlomin/render-template@v1.7
uses: chuhlomin/render-template@v1.8
with:
template: kube.template.yml
vars: |
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ outputs:

runs:
using: docker
image: 'docker://chuhlomin/render-template:v1.7'
image: 'docker://chuhlomin/render-template:v1.8'

0 comments on commit 6fb1fba

Please sign in to comment.