Skip to content

Commit 2e143e9

Browse files
authored
Merge pull request #13 from mcayland/feature/github-workflow
Feature: add GitHub workflows to build docker containers
2 parents e9816e0 + f0fb483 commit 2e143e9

4 files changed

Lines changed: 102 additions & 0 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Build fcode-utils-builder container
2+
3+
# Run manually from Actions tab
4+
on: [workflow_dispatch]
5+
6+
env:
7+
REGISTRY: ghcr.io
8+
IMAGE_NAME: ${{ github.repository }}-builder
9+
10+
jobs:
11+
build-x86_64:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
packages: write
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v2
20+
21+
- name: Log in to the Container registry
22+
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
23+
with:
24+
registry: ${{ env.REGISTRY }}
25+
username: ${{ github.actor }}
26+
password: ${{ secrets.GITHUB_TOKEN }}
27+
28+
- name: Extract metadata (tags, labels) for Docker
29+
id: meta
30+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
31+
with:
32+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
33+
34+
- name: Build and push Docker image
35+
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
36+
with:
37+
context: .
38+
file: docker/Dockerfile.builder
39+
push: true
40+
tags: ${{ steps.meta.outputs.tags }}
41+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/main.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Build fcode-utils
2+
3+
on: [push, workflow_dispatch]
4+
5+
env:
6+
REGISTRY: ghcr.io
7+
IMAGE_NAME: ${{ github.repository }}
8+
9+
jobs:
10+
build-x86_64:
11+
runs-on: ubuntu-latest
12+
name: fcode-utils for x86_64
13+
steps:
14+
- name: Checkout fcode-utils
15+
uses: actions/checkout@v2
16+
17+
- name: Log in to the Container registry
18+
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
19+
with:
20+
registry: ${{ env.REGISTRY }}
21+
username: ${{ github.actor }}
22+
password: ${{ secrets.GITHUB_TOKEN }}
23+
24+
- name: Extract metadata (tags, labels) for Docker
25+
id: meta
26+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
27+
with:
28+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
29+
30+
- name: Build fcode-utils
31+
uses: docker://ghcr.io/openbios/fcode-utils-builder:master
32+
with:
33+
args: "bash -c \"mkdir -p $(pwd)/build-$(uname -m) && make && make DESTDIR=$(pwd)/build-$(uname -m) install\""
34+
35+
- name: Copy localvalues
36+
uses: docker://ghcr.io/openbios/fcode-utils-builder:master
37+
with:
38+
args: "bash -c \"cp -R localvalues build-$(uname -m)\""
39+
40+
- name: Store x86_64 artifacts
41+
uses: actions/upload-artifact@v2
42+
with:
43+
name: fcode-utils-x86_64
44+
path: |
45+
build-x86_64
46+
47+
- name: Build and push Docker image
48+
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
49+
with:
50+
context: .
51+
file: docker/Dockerfile
52+
push: true
53+
tags: ${{ steps.meta.outputs.tags }}
54+
labels: ${{ steps.meta.outputs.labels }}

docker/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM debian:11.2
2+
3+
COPY build-x86_64/bin/* /usr/bin

docker/Dockerfile.builder

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM debian:11.2
2+
3+
RUN apt-get -y update && \
4+
apt-get -y install build-essential git

0 commit comments

Comments
 (0)