3 Star 0 Fork 0

mirrors_vmware-archive/containers-with-sboms

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
golang_container.sh 1.16 KB
一键复制 编辑 原始数据 按行查看 历史
#!/bin/sh
#
# Copyright (c) 2021 VMware, Inc.
# SPDX-License-Identifier: BSD-2-Clause
# This script will build a container image with a golang1.16.6 binary installed
# The SBOM for the golang binary is created by hand (but it could be the output of
# a golang release.
# We create a container image using buildah from the previously built debian:10 image
echo starting...
ctr=$(buildah from localhost:5000/debian:10)
buildah unshare buildah mount $ctr
echo building container...
# Install golang
buildah unshare buildah run $ctr /bin/bash -c "apt-get update && apt-get install -y wget && wget https://golang.org/dl/go1.16.6.linux-amd64.tar.gz && tar -C /usr/local -xzf go1.16.6.linux-amd64.tar.gz && apt-get remove -y wget"
buildah config --env PATH=/bin:/usr/local/go/bin $ctr
# Create our golang image
img=$(buildah commit $ctr localhost:5000/golang:1.16.6)
# Upload the golang image with the corresponding sboms
oras pull localhost:5000/debian-sbom:10 -a
buildah push --tls-verify=false localhost:5000/golang:1.16.6
oras push localhost:5000/golang-sbom:1.16.6 debian-sbom:application/json golang1.16.6-sbom:application/json
# Clean up all the containers
buildah rm --all
echo ready
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_vmware-archive/containers-with-sboms.git
git@gitee.com:mirrors_vmware-archive/containers-with-sboms.git
mirrors_vmware-archive
containers-with-sboms
containers-with-sboms
main

搜索帮助