Skip to content

Commit a389f55

Browse files
committed
Add skopeo_cidev container image build
Signed-off-by: Tim Zhou <tizhou@redhat.com>
1 parent ebd307c commit a389f55

7 files changed

Lines changed: 219 additions & 0 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Build container images
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
push:
7+
type: boolean
8+
default: false
9+
tag:
10+
type: string
11+
default: ""
12+
13+
permissions: {}
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
name: "${{ matrix.image }}"
19+
timeout-minutes: 30
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
image:
24+
- "skopeo_cidev"
25+
steps:
26+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
27+
28+
- name: Log in to ghcr.io
29+
if: ${{ inputs.push }}
30+
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
31+
with:
32+
registry: ghcr.io
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Build and push
37+
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
38+
with:
39+
context: ${{ matrix.image }}
40+
file: ${{ matrix.image }}/Containerfile
41+
push: ${{ inputs.push }}
42+
tags: ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}:${{ inputs.tag != '' && inputs.tag || github.ref_name }}

.github/workflows/pr.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ permissions: {}
1414
jobs:
1515
build-images:
1616
uses: ./.github/workflows/build_images.yml
17+
18+
build-container-images:
19+
uses: ./.github/workflows/build_container_images.yml

.github/workflows/release.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ jobs:
1212
build-images:
1313
uses: ./.github/workflows/build_images.yml
1414

15+
build-container-images:
16+
uses: ./.github/workflows/build_container_images.yml
17+
permissions:
18+
contents: read
19+
packages: write
20+
with:
21+
push: true
22+
tag: ${{ github.ref_name }}
23+
1524
create-release:
1625
# use a larger runner in hope of better network speeds
1726
runs-on: oracle-vm-16cpu-64gb-x86-64

skopeo_cidev/Containerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
ARG BASE_NAME=fedora
2+
ARG BASE_TAG=latest
3+
FROM ${BASE_NAME}:${BASE_TAG}
4+
5+
# Required to keep perl & other tooling happy
6+
ENV LC_ALL="C"
7+
8+
COPY /packages.txt /root/
9+
RUN dnf -y update && \
10+
dnf -y install $(sed -r -e '/^#/d' -e '/^$/d' /root/packages.txt) && \
11+
dnf -y upgrade && \
12+
dnf clean all
13+
14+
ENV REG_REPO="https://github.com/docker/distribution.git" \
15+
REG_COMMIT_SCHEMA1_ONLY="ec87e9b6971d831f0eff752ddb54fb64693e51cd" \
16+
REG_COMMIT_SCHEMA1_SUPPORTED="4772604ae973031ab32dd9805a4bccf61d94909f" \
17+
OSO_REPO="https://github.com/openshift/origin.git" \
18+
OSO_TAG="v1.5.0-alpha.3"
19+
20+
COPY /setup.sh /root/
21+
RUN bash /root/setup.sh

skopeo_cidev/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Skopeo CI/Dev image
2+
3+
Built and pushed to `ghcr.io/podman-container-tools/skopeo_cidev:<tag>` by
4+
`.github/workflows/build_container_images.yml` on every release tag.
5+
6+
Used by the [skopeo](https://github.com/podman-container-tools/skopeo) and
7+
related projects for CI. Not intended for use outside those contexts.

skopeo_cidev/packages.txt

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# general deps
2+
docker-distribution
3+
git
4+
golang
5+
golang-github-cpuguy83-md2man
6+
make
7+
8+
# Skopeo documentation building
9+
btrfs-progs-devel
10+
device-mapper-devel
11+
golang
12+
gpgme-devel
13+
make
14+
15+
# storage deps
16+
btrfs-progs-devel
17+
device-mapper-devel
18+
19+
# gpgme bindings deps
20+
libassuan-devel
21+
gnupg
22+
gpgme-devel
23+
24+
# htpasswd for system tests
25+
httpd-tools
26+
27+
# OpenShift deps
28+
bats
29+
bsdtar
30+
device-mapper
31+
docker
32+
e2fsprogs
33+
ethtool
34+
findutils
35+
golint
36+
hostname
37+
iproute
38+
iptables
39+
jq
40+
lsof
41+
nmap-ncat
42+
openssl
43+
podman
44+
runc
45+
socat
46+
tar
47+
tree
48+
util-linux
49+
wget
50+
which
51+
xfsprogs

skopeo_cidev/setup.sh

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
2+
3+
# This script is used by the Containerfile when building an image.
4+
# It should NEVER ever (EVER!) be used under any other circumstances
5+
# (nor set as executable).
6+
7+
set -e
8+
9+
declare -a req_vars
10+
req_vars=(\
11+
REG_REPO
12+
REG_COMMIT_SCHEMA1_ONLY
13+
REG_COMMIT_SCHEMA1_SUPPORTED
14+
OSO_REPO
15+
OSO_TAG
16+
)
17+
for req_var in "${req_vars[@]}"; do
18+
if [[ -z "${!req_var}" ]]; then
19+
echo "ERROR: Required variable \$$req_var is unset or empty."
20+
exit 1
21+
fi
22+
done
23+
24+
GOPATH=$(mktemp -d -p '' ".tmp_$(basename ${BASH_SOURCE[0]})_XXXXXXXX")
25+
REG_GOSRC="$GOPATH/src/github.com/docker/distribution" \
26+
OSO_GOSRC="$GOPATH/src/github.com/openshift/origin"
27+
28+
# All golang code built here pre-dates support of go modules
29+
export GO111MODULE=off
30+
31+
# Workaround unnecessary swap-enabling shenanagains in openshift-origin build
32+
export OS_BUILD_SWAP_DISABLE=1
33+
34+
# Make debugging easier
35+
set -x
36+
37+
# This comes in from the Containerfile
38+
# shellcheck disable=SC2154
39+
git clone "$REG_REPO" "$REG_GOSRC"
40+
cd "$REG_GOSRC"
41+
42+
# Don't pollute the environment
43+
(
44+
# This is required to be set like this by the build system
45+
export GOPATH="$PWD/Godeps/_workspace:$GOPATH"
46+
# This comes in from the Containerfile
47+
# shellcheck disable=SC2154
48+
git checkout -q "$REG_COMMIT_SCHEMA1_ONLY"
49+
go build -o /usr/local/bin/registry-v2-schema1-only \
50+
github.com/docker/distribution/cmd/registry
51+
)
52+
53+
(
54+
export GOPATH
55+
# This comes in from the Containerfile
56+
# shellcheck disable=SC2154
57+
git checkout -q "$REG_COMMIT_SCHEMA1_SUPPORTED"
58+
go build -o /usr/local/bin/registry-v2-schema1-supported \
59+
github.com/docker/distribution/cmd/registry
60+
)
61+
62+
# These come in from the Containerfile
63+
# shellcheck disable=SC2154
64+
git clone --depth 1 -b "$OSO_TAG" "$OSO_REPO" "$OSO_GOSRC"
65+
cd "$OSO_GOSRC"
66+
67+
# Edit out a "go < 1.5" check which works incorrectly with go >= 1.10.
68+
sed -i -e 's/\[\[ "\${go_version\[2]}" < "go1.5" ]]/false/' ./hack/common.sh
69+
70+
# Fix a bug in 'options' line processing of resolv.conf when an option is
71+
# 8 characters long. This can happen if/when systemd-resolved adds 'trust-ad'.
72+
sed -i '/== "attempts:"/s/ 8 / 9 /' vendor/github.com/miekg/dns/clientconfig.go
73+
74+
# Backport https://github.com/ugorji/go/commit/8286c2dc986535d23e3fad8d3e816b9dd1e5aea6
75+
# Go ≥ 1.22 panics with a base64 encoding using duplicated characters.
76+
sed -i -e 's,"encoding/base64","encoding/base32", ; s,base64.NewEncoding("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789__"),base32.NewEncoding("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef"),' vendor/github.com/ugorji/go/codec/gen.go
77+
78+
make build
79+
make all WHAT=cmd/dockerregistry
80+
cp -a ./_output/local/bin/linux/*/* /usr/local/bin/
81+
cp ./images/dockerregistry/config.yml /atomic-registry-config.yml
82+
mkdir /registry
83+
84+
# When script unsuccessful, leave this behind for debugging
85+
# Removing these two items _significantly_ reduces the image size.
86+
rm -rf $GOPATH $(go env GOCACHE)

0 commit comments

Comments
 (0)