Skip to content

Commit 5c15cd1

Browse files
author
Ananth Bhaskararaman
committed
Switch to gcc. Container images only on release.
1 parent 2c27581 commit 5c15cd1

File tree

2 files changed

+35
-30
lines changed

2 files changed

+35
-30
lines changed

.github/workflows/ci.yaml

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ on:
1111

1212
env:
1313
GO_VERSION: 1.19
14-
ZIG_VERSION: 0.10.0
1514

1615
jobs:
1716
lint:
@@ -41,30 +40,25 @@ jobs:
4140
uses: actions/setup-go@v3
4241
with:
4342
go-version: ${{ env.GO_VERSION }}
44-
- name: Setup zig
45-
uses: goto-bus-stop/setup-zig@v2
46-
with:
47-
version: ${{ env.ZIG_VERSION }}
4843
- name: Build binary
4944
run: |
50-
env CGO_ENABLED=1 \
51-
CC="zig cc -target x86_64-linux-musl" \
52-
CXX="zig c++ -target x86_64-linux-musl" \
53-
go build
45+
mkdir build
46+
go build -o build ./...
5447
- name: Upload binary
5548
uses: actions/upload-artifact@v3
5649
with:
5750
name: bifrost
58-
path: bifrost
51+
path: build/**
5952
- name: Update Github release
6053
if: startsWith(github.ref, 'refs/tags/')
6154
uses: softprops/action-gh-release@v1
6255
with:
6356
append_body: true
6457
generate_release_notes: true
65-
files: bifrost
58+
files: build/**
6659

6760
images:
61+
if: startsWith(github.ref, 'refs/tags/')
6862
name: Build and push images to ghcr.io
6963
runs-on: ubuntu-latest
7064
concurrency:
@@ -78,25 +72,45 @@ jobs:
7872
- name: Set environment variables
7973
run: |
8074
echo "SHORT_SHA=$(echo $GITHUB_SHA | cut -c1-8)" >>"$GITHUB_ENV"
81-
- name: Build image
75+
- name: Build bouncer image
8276
uses: redhat-actions/buildah-build@v2
83-
id: build_image
77+
id: build_bouncer_image
8478
with:
8579
image: ${{ github.repository }}
86-
build-args: |
87-
GO_VERSION=${{ env.GO_VERSION }}
88-
ZIG_VERSION=${{ env.ZIG_VERSION }}
80+
build-args: GO_VERSION=${{ env.GO_VERSION }}
81+
extra-args: --target=bouncer
8982
tags: >
9083
latest
9184
${{ env.SHORT_SHA }}
9285
${{ github.sha }}
9386
${{ github.event.release.tag_name }}
9487
containerfiles: Dockerfile
95-
- name: Push image
88+
- name: Build issuer image
89+
uses: redhat-actions/buildah-build@v2
90+
id: build_issuer_image
91+
with:
92+
image: ${{ github.repository }}
93+
build-args: GO_VERSION=${{ env.GO_VERSION }}
94+
extra-args: --target=issuer
95+
tags: >
96+
latest
97+
${{ env.SHORT_SHA }}
98+
${{ github.sha }}
99+
${{ github.event.release.tag_name }}
100+
containerfiles: Dockerfile
101+
- name: Push bouncer image
102+
uses: redhat-actions/push-to-registry@v2
103+
with:
104+
registry: ghcr.io
105+
username: ${{ github.actor }}
106+
password: ${{ secrets.GITHUB_TOKEN }}
107+
image: ${{ steps.build_bouncer_image.outputs.image }}
108+
tags: ${{ steps.build_bouncer_image.outputs.tags }}
109+
- name: Push issuer image
96110
uses: redhat-actions/push-to-registry@v2
97111
with:
98112
registry: ghcr.io
99113
username: ${{ github.actor }}
100114
password: ${{ secrets.GITHUB_TOKEN }}
101-
image: ${{ steps.build_image.outputs.image }}
102-
tags: ${{ steps.build_image.outputs.tags }}
115+
image: ${{ steps.build_issuer_image.outputs.image }}
116+
tags: ${{ steps.build_issuer_image.outputs.tags }}

Dockerfile

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,12 @@
11
ARG GO_VERSION="1.19"
22

33
FROM docker.io/library/golang:${GO_VERSION}-alpine as builder
4-
ARG ZIG_VERSION="0.10.0"
5-
RUN apk add --quiet --no-cache --update \
6-
build-base git
7-
RUN wget -qO- https://ziglang.org/download/${ZIG_VERSION}/zig-linux-x86_64-${ZIG_VERSION}.tar.xz \
8-
| unxz | tar x -C /usr/local/bin --strip-components 1 \
9-
zig-linux-x86_64-${ZIG_VERSION}/zig \
10-
zig-linux-x86_64-${ZIG_VERSION}/lib
4+
RUN apk add --quiet --no-cache --update git
115
WORKDIR /src
126
COPY . .
137
ENV GOPRIVATE="github.com/RealImage/*"
148
RUN mkdir /build
15-
RUN env CGO_ENABLED=1 \
16-
CC="zig cc -target x86_64-linux-musl" \
17-
CXX="zig c++ -target x86_64-linux-musl" \
18-
go build -o /build ./...
9+
RUN go build -o /build ./...
1910

2011
FROM gcr.io/distroless/static as bouncer
2112
COPY --from=builder /build/bouncer /

0 commit comments

Comments
 (0)