Skip to content

Commit 52f6b7b

Browse files
authored
Initial pipeline (#1)
* init * readme * images
1 parent 1530a71 commit 52f6b7b

File tree

3 files changed

+96
-0
lines changed

3 files changed

+96
-0
lines changed

.github/workflows/image-build.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: image-build
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
USER: ${{secrets.DOCKER_USER}}
8+
9+
jobs:
10+
docker_build:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
include:
15+
- os: ubuntu-24.04
16+
arch: amd64
17+
- os: ubuntu-24.04-arm
18+
arch: arm64
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
- name: Log in to Docker Hub
23+
uses: docker/login-action@v3
24+
with:
25+
username: ${{env.USER}}
26+
password: ${{secrets.DOCKER_PAT}}
27+
- name: Build and push
28+
run: |
29+
docker build --tag ${{env.USER}}/docker-uname:${{matrix.arch}} .
30+
docker push ${{env.USER}}/docker-uname:${{matrix.arch}}
31+
32+
docker_manifest:
33+
needs: docker_build
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: Log in to Docker Hub
37+
uses: docker/login-action@v3
38+
with:
39+
username: ${{env.USER}}
40+
password: ${{secrets.DOCKER_PAT}}
41+
- name: Create and push manifest
42+
run: |
43+
docker manifest create ${{env.USER}}/docker-uname ${{env.USER}}/docker-uname:amd64 ${{env.USER}}/docker-uname:arm64
44+
docker manifest push ${{env.USER}}/docker-uname

Dockerfiles

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
FROM ubuntu:latest
2+
CMD echo -n "Architecture is " && uname -m

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Build multi architectural docker images via GitHub Actions
2+
3+
## Steps
4+
5+
### Create a New GitHub Repository as a Fork
6+
7+
1. Navigate to the [workshop-github-actions repository](https://github.com/ArmDeveloperEcosystem/workshop-github-actions/).
8+
2. Click the **Fork** button in the top-right corner of the page.
9+
3. In the **Create a fork** dialog:
10+
- Select your GitHub account or organization where you want to create the fork.
11+
- Optionally, provide a name for the forked repository (default is `workshop-github-actions`).
12+
- Click **Create fork**.
13+
14+
### Retrieve Your Docker Username and Password
15+
16+
1. **Docker Username**:
17+
Your Docker username is the name you use to log in to [Docker Hub](https://hub.docker.com/).
18+
19+
2. **Docker Personal Access Token**:
20+
- Log in to [Docker Hub](https://hub.docker.com/).
21+
- Navigate to your account settings.
22+
- Go to Personal Access Token
23+
- Click on **Create Access Token**.
24+
- Provide a name for the token (e.g., `github-actions-token`).
25+
- Select the desired expiration date for the token.
26+
- Under **Access Permissions**, ensure you grant **read & write** access to repositories.
27+
- Click **Generate** and copy the token.
28+
**Note**: Make sure to save the token securely as it will not be shown again.
29+
30+
### Add Docker Credentials to GitHub Actions
31+
32+
1. Go to your GitHub repository.
33+
2. Click on the **Settings** tab.
34+
3. In the left sidebar, select **Secrets and variables** > **Actions**.
35+
4. Click the **New repository secret** button.
36+
5. Add the following secrets:
37+
- `DOCKER_USER`: Your Docker username.
38+
- `DOCKER_PAT`: Your Docker Personal Access Token we generated above.
39+
40+
### Run the GitHub Actions Workflow
41+
42+
1. Go to the `Actions` page for your GitHub repository.
43+
2. Trigger the `image-build.yml` workflow manually:
44+
- The workflow is located at [`.github/workflows/image-build.yml`](.github/workflows/image-build.yml)
45+
- From the `Actions` page, click **Run workflow**.
46+
3. Monitor the workflow execution:
47+
- Check the progress and logs in the **Actions** tab.
48+
- Ensure the workflow completes successfully without errors.
49+
50+
Once the workflow finishes, your multi-architecture Docker images will be built and pushed to Docker Hub.

0 commit comments

Comments
 (0)