forked from CCCHH/ansible-infra
Vendor Galaxy Roles and Collections
This commit is contained in:
parent
c1e1897cda
commit
2aed20393f
3553 changed files with 387444 additions and 2 deletions
26
ansible_collections/community/docker/tests/images/build.sh
Executable file
26
ansible_collections/community/docker/tests/images/build.sh
Executable file
|
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/env bash
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
if [ ! -e main.go ]; then
|
||||
echo "Must be run in a directory that contains main.go."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set -eux
|
||||
IMAGE_NAME="${1:-localhost/$(basename "$(pwd)"):latest}"
|
||||
podman manifest rm "${IMAGE_NAME}" || true
|
||||
podman image rm "${IMAGE_NAME}" || true
|
||||
buildah manifest create "${IMAGE_NAME}"
|
||||
for ARCH in amd64 arm64 386; do
|
||||
rm -f "main-${ARCH}"
|
||||
GOARCH="${ARCH}" go build -ldflags "-s -w" -o "main-${ARCH}" main.go
|
||||
|
||||
WORKING_CONTAINER="$(buildah from --arch "${ARCH}" scratch)"
|
||||
buildah copy "${WORKING_CONTAINER}" "main-${ARCH}" "/runme"
|
||||
buildah config --entrypoint '["/runme"]' "${WORKING_CONTAINER}"
|
||||
buildah commit --manifest "${IMAGE_NAME}" "${WORKING_CONTAINER}"
|
||||
|
||||
rm -f "main-${ARCH}"
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue