-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add workflow for building and publishing builder image
- Loading branch information
1 parent
1675cf3
commit 87c0682
Showing
2 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Build and Push Builder Image | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- master | ||
- feat/fips-image-and-workflow # for testing purposes | ||
|
||
jobs: | ||
build-and-push: | ||
name: Build and Push Builder Image | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Log in to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set version | ||
id: set_version | ||
run: | | ||
VERSION="${{ github.run_number }}-$(date +'%Y%m%d%H%M%S')" | ||
echo "VERSION=$VERSION" >> $GITHUB_ENV | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
file: build/Dockerfile | ||
push: true | ||
tags: | | ||
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ env.VERSION }} | ||
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Use Ubuntu 16.04 as the base image | ||
FROM ubuntu:16.04 | ||
|
||
# Define Go version | ||
ARG GO_VERSION=1.23.2 | ||
ARG ARCH='amd64' | ||
ARG GH_VERSION='2.61.0' | ||
|
||
# Install dependencies | ||
RUN apt-get update && apt-get install -y \ | ||
gnupg-agent \ | ||
unzip \ | ||
zip \ | ||
curl \ | ||
wget \ | ||
expect \ | ||
git \ | ||
tar \ | ||
gcc \ | ||
jq \ | ||
g++ \ | ||
gnupg2 \ | ||
gnupg-agent \ | ||
debsigs \ | ||
rpm \ | ||
build-essential \ | ||
software-properties-common \ | ||
python-software-properties \ | ||
gcc-arm-linux-gnueabi \ | ||
dpkg-sig \ | ||
gcc-aarch64-linux-gnu | ||
|
||
# Install Go | ||
RUN curl -sSL https://golang.org/dl/go${GO_VERSION}.linux-${ARCH}.tar.gz -o go${GO_VERSION}.linux-${ARCH}.tar.gz && \ | ||
tar -C /usr/local -xzf go${GO_VERSION}.linux-${ARCH}.tar.gz && \ | ||
rm go${GO_VERSION}.linux-${ARCH}.tar.gz | ||
|
||
# Set Go environment variables | ||
ENV PATH="/usr/local/go/bin:${PATH}" | ||
ENV GOPATH="/go" | ||
|
||
# Optional: Set Go environment flags | ||
ENV GOFLAGS="-buildvcs=false" | ||
|
||
# Since the user does not match the owners of the repo "git rev-parse --is-inside-work-tree" fails and goreleaser does not populate projectName | ||
# https://stackoverflow.com/questions/72978485/git-submodule-update-failed-with-fatal-detected-dubious-ownership-in-repositor | ||
RUN git config --global --add safe.directory '*' | ||
RUN curl -L https://github.com/cli/cli/releases/download/v${GH_VERSION}/gh_${GH_VERSION}_linux_amd64.deb -o gh_${GH_VERSION}_linux_amd64.deb | ||
RUN dpkg -i gh_${GH_VERSION}_linux_amd64.deb |