Skip to content

Commit ccc04d3

Browse files
committed
foo
1 parent 891a6f3 commit ccc04d3

3 files changed

Lines changed: 86 additions & 12 deletions

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: "Build and Push Simple Docker Image"
2+
description: "Reusable action to build and push a Docker image for any repo, with simple platform/version args."
3+
inputs:
4+
docker_username:
5+
description: "DockerHub Username"
6+
required: true
7+
docker_password:
8+
description: "DockerHub Password"
9+
required: true
10+
github_token:
11+
description: "GitHub Token for GitHub Container Registry"
12+
required: true
13+
platforms:
14+
description: "Target platforms (comma-separated, e.g. linux/amd64,linux/arm64)"
15+
required: false
16+
default: "linux/amd64,linux/arm64"
17+
version:
18+
description: "Image version tag (optional)"
19+
required: false
20+
default: ""
21+
runs:
22+
using: "composite"
23+
steps:
24+
- name: Login to DockerHub
25+
uses: docker/login-action@v3
26+
with:
27+
username: ${{ inputs.docker_username }}
28+
password: ${{ inputs.docker_password }}
29+
- name: Login to GitHub Container Registry
30+
uses: docker/login-action@v3
31+
with:
32+
registry: ghcr.io
33+
username: ${{ github.actor }}
34+
password: ${{ inputs.github_token }}
35+
- name: Set up Docker Buildx
36+
uses: docker/setup-buildx-action@v3
37+
- name: Build and Push Docker Image
38+
uses: docker/build-push-action@v6
39+
with:
40+
context: .
41+
file: ./Containerfile
42+
platforms: ${{ inputs.platforms }}
43+
push: true
44+
tags: |
45+
ghcr.io/${{ github.repository }}${{ inputs.version && format(':{}', inputs.version) || '' }}
46+
docker.io/${{ github.repository }}${{ inputs.version && format(':{}', inputs.version) || '' }}

.github/workflows/build.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Build Image (Manual)
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
platforms:
7+
description: 'Target platforms (comma-separated, e.g. linux/amd64,linux/arm64)'
8+
required: false
9+
default: 'linux/amd64,linux/arm64'
10+
version:
11+
description: 'Image version tag (optional)'
12+
required: false
13+
default: ''
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Build and Push Docker Image
21+
uses: ./.github/actions/build_simple_image
22+
with:
23+
docker_username: ${{ secrets.DOCKER_USERNAME }}
24+
docker_password: ${{ secrets.DOCKER_PASSWORD }}
25+
github_token: ${{ secrets.GITHUB_TOKEN }}
26+
platforms: ${{ github.event.inputs.platforms }}
27+
version: ${{ github.event.inputs.version }}

.github/workflows/main.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
name: Build, Tag, and Push Image (with Login Action)
1+
name: Build Image
22

33
on:
44
workflow_call:
55
inputs:
6-
docker_username:
7-
required: true
6+
platforms:
7+
description: 'Target platforms (comma-separated, e.g. linux/amd64,linux/arm64)'
8+
required: false
89
type: string
9-
docker_password:
10-
required: true
11-
type: string
12-
github_token:
13-
required: true
10+
default: 'linux/amd64,linux/arm64'
11+
version:
12+
description: 'Image version tag (optional)'
13+
required: false
1414
type: string
15-
# Add any other inputs your action.yaml expects (e.g., DISTRO, DISTRO_VARIANT, etc.)
15+
default: ''
1616
secrets:
1717
docker_username:
1818
required: true
@@ -26,10 +26,11 @@ jobs:
2626
runs-on: ubuntu-latest
2727
steps:
2828
- uses: actions/checkout@v4
29-
- name: Build, Tag, and Push
30-
uses: ./.github/actions/action.yaml
29+
- name: Build and Push Docker Image
30+
uses: ./.github/actions/build_simple_image
3131
with:
3232
docker_username: ${{ secrets.docker_username }}
3333
docker_password: ${{ secrets.docker_password }}
3434
github_token: ${{ secrets.github_token }}
35-
# Pass through any other needed inputs
35+
platforms: ${{ inputs.platforms }}
36+
version: ${{ inputs.version }}

0 commit comments

Comments
 (0)