From 67ca0914bb074ae7598ce9e2c8ff4125f6abfcfbf02a8df74fca5130e5b24f9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= Date: Fri, 20 Dec 2024 10:48:46 +0000 Subject: [PATCH] [info=1c2f3dc6e64712ae694230cb90afe451] OBS-URL: https://build.opensuse.org/package/show/devel:BCI:Tumbleweed/golang-oldstable-image?expand=0&rev=224 --- .gitattributes | 23 ++++ .gitignore | 1 + Dockerfile | 59 ++++++++ README.md | 135 +++++++++++++++++++ _constraints | 7 + _service | 10 ++ golang-oldstable-image.changes | 239 +++++++++++++++++++++++++++++++++ 7 files changed, 474 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 _constraints create mode 100644 _service create mode 100644 golang-oldstable-image.changes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..932f93e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,59 @@ +# SPDX-License-Identifier: MIT + +# Copyright (c) 2024 SUSE LLC + +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. + +# The content of THIS FILE IS AUTOGENERATED and should not be manually modified. +# It is maintained by the BCI team and generated by +# https://github.com/SUSE/BCI-dockerfile-generator + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# You can contact the BCI team via https://github.com/SUSE/bci/discussions + +#!UseOBSRepositories + +#!BuildTag: opensuse/bci/golang:oldstable-2.%RELEASE% +#!BuildTag: opensuse/bci/golang:oldstable +#!BuildTag: opensuse/bci/golang:%%golang_version%%-2.%RELEASE% +#!BuildTag: opensuse/bci/golang:%%golang_version%% +#!BuildTag: opensuse/bci/golang:1.22 + +FROM opensuse/tumbleweed:latest + +RUN set -euo pipefail; \ + zypper -n install --no-recommends go1.22 go1.22-doc make curl findutils gawk git-core procps util-linux; \ + zypper -n clean; \ + rm -rf {/target,}/var/log/{alternatives.log,lastlog,tallylog,zypper.log,zypp/history,YaST2} + +# Define labels according to https://en.opensuse.org/Building_derived_containers +# labelprefix=org.opensuse.bci.golang +LABEL org.opencontainers.image.title="openSUSE Tumbleweed BCI Go 1.22 development" +LABEL org.opencontainers.image.description="Go 1.22 development container based on the openSUSE Tumbleweed Base Container Image." +LABEL org.opencontainers.image.version="%%golang_version%%" +LABEL org.opencontainers.image.url="https://www.opensuse.org" +LABEL org.opencontainers.image.created="%BUILDTIME%" +LABEL org.opencontainers.image.vendor="openSUSE Project" +LABEL org.opencontainers.image.source="%SOURCEURL%" +LABEL org.opencontainers.image.ref.name="%%golang_version%%-2.%RELEASE%" +LABEL org.opensuse.reference="registry.opensuse.org/opensuse/bci/golang:%%golang_version%%-2.%RELEASE%" +LABEL org.openbuildservice.disturl="%DISTURL%" +LABEL org.opensuse.lifecycle-url="https://en.opensuse.org/Lifetime#openSUSE_BCI" +LABEL org.opensuse.release-stage="released" +# endlabelprefix +LABEL io.artifacthub.package.readme-url="https://raw.githubusercontent.com/SUSE/BCI-dockerfile-generator/Tumbleweed/golang-oldstable-image/README.md" +ENV GOLANG_VERSION="%%golang_version%%" +ENV GOPATH="/go" +ENV GOTOOLCHAIN="local" +ENV PATH="/go/bin:/usr/local/go/bin:/root/go/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + + +# only available on go's tsan_arch architectures +#!ArchExclusiveLine: x86_64 aarch64 s390x ppc64le +RUN set -euo pipefail; if zypper -n install go1.22-race; then zypper -n clean; fi +RUN set -euo pipefail; install -m 755 -d /go/bin /go/src +RUN set -euo pipefail; rm -rf {/target,}/var/log/{alternatives.log,lastlog,tallylog,zypper.log,zypp/history,YaST2} +WORKDIR /go + diff --git a/README.md b/README.md new file mode 100644 index 0000000..5191305 --- /dev/null +++ b/README.md @@ -0,0 +1,135 @@ +# Go 1.22 development container image + +![Redistributable](https://img.shields.io/badge/Redistributable-Yes-green) + +## Description + +[Go](https://go.dev/) (a.k.a., Golang) is a statically-typed programming +language, with syntax loosely derived from C. Go offers additional features +such as garbage collection, type safety, certain dynamic-typing capabilities, +additional built-in types (for example, variable-length arrays and key-value +maps) as well as a large standard library. + + +## Usage +We recommend using the Go image as a build environment. Thus, +the compiler does not need to be shipped as part of the images that are +deployed. Instead, we recommend to use the Go image as the +builder image only. + +There are two options to work with Go images. First, you can encapsulate your +application in a `scratch` container image, essentially an empty filesystem +image. This approach only works if your Go application does not depend on libc +or any other library or files, as they will not be available. + +The second option uses a slim base container image with just the minimal +packages required to run the Go application. + +To compile and deploy an application, copy the sources, fetch dependencies +(assuming go.mod is used for dependency management), and build the binary using +the following Dockerfile options. + + +### Building from `scratch` + +```Dockerfile +# Build the application using the Go 1.22 development container image +FROM registry.opensuse.org/opensuse/bci/golang:1.22 as build + +WORKDIR /app + +# pre-copy/cache go.mod for pre-downloading dependencies and only +# redownloading them in subsequent builds if they change +COPY go.mod go.sum ./ +RUN go mod download && go mod verify + +COPY . ./ + +# Make sure to build the application with CGO disabled. +# This will force Go to use some Go implementations of code +# rather than those supplied by the host operating system. +# You need this for scratch images as those supporting libraries +# are not available. +RUN CGO_ENABLED=0 go build -o /hello + +# Bundle the application into a scratch image +FROM scratch + +COPY --from=build /hello /usr/local/bin/hello + +CMD ["/usr/local/bin/hello"] +``` + +Build and run the container image: + +```ShellSession +$ podman build -t my-golang-app . +$ podman run -it --rm my-golang-app +``` + +There are situations when you don't want to run an application inside a container. + +To compile the application, without running it inside a container instance, use the following command: + +```ShellSession +$ podman run --rm -v "$PWD":/app:Z -w /app registry.opensuse.org/opensuse/bci/golang:1.22 go build -v +``` + +To run the application tests inside a container, use the following command: + +```ShellSession +$ podman run --rm -v "$PWD":/app:Z -w /app registry.opensuse.org/opensuse/bci/golang:1.22 go test -v +``` + + +### Building from SLE BCI + +The [SLE BCI General Purpose Base Containers](https://opensource.suse.com/bci-docs/documentation/general-purpose-bci/) +images offer four different options for deployment, depending on your exact requirements. + +```Dockerfile +# Build the application using the Go 1.22 development Container Image +FROM registry.opensuse.org/opensuse/bci/golang:1.22 as build + +WORKDIR /app + +# pre-copy/cache go.mod for pre-downloading dependencies and only +# redownloading them in subsequent builds if they change +COPY go.mod go.sum ./ +RUN go mod download && go mod verify + +COPY . ./ + +RUN go build -o /hello + +# Bundle the application into a scratch image +FROM registry.opensuse.org/opensuse/bci/bci-micro:latest + +COPY --from=build /hello /usr/local/bin/hello + +CMD ["/usr/local/bin/hello"] +``` + +The above example uses the SLE BCI micro image as the deployment image for +the resulting application. See the [SLE BCI use with Go +documentation](https://opensource.suse.com/bci-docs/guides/use-with-golang/) +for further details. + + +## Additional tools + +In addition to the standard SLE BCI development packages, the following tools +are included in the image: + +- go1.22-race +- make + +## Licensing + +`SPDX-License-Identifier: MIT` + +This documentation and the build recipe are licensed as MIT. +The container itself contains various software components under various open source licenses listed in the associated +Software Bill of Materials (SBOM). + +This image is based on [openSUSE Tumbleweed](https://get.opensuse.org/tumbleweed/). diff --git a/_constraints b/_constraints new file mode 100644 index 0000000..02387b4 --- /dev/null +++ b/_constraints @@ -0,0 +1,7 @@ + + + + 8 + + + diff --git a/_service b/_service new file mode 100644 index 0000000..1ed223b --- /dev/null +++ b/_service @@ -0,0 +1,10 @@ + + + + + Dockerfile + %%golang_version%% + go1.22 + patch + + \ No newline at end of file diff --git a/golang-oldstable-image.changes b/golang-oldstable-image.changes new file mode 100644 index 0000000..6433da4 --- /dev/null +++ b/golang-oldstable-image.changes @@ -0,0 +1,239 @@ +------------------------------------------------------------------- +Fri Dec 20 10:46:43 UTC 2024 - SUSE Update Bot + +- limit to patch level version to avoid the go language ecosystem from being confused + +------------------------------------------------------------------- +Tue Dec 3 13:26:37 UTC 2024 - SUSE Update Bot + +- Change attribute order in _service + +------------------------------------------------------------------- +Wed Oct 30 15:34:45 UTC 2024 - SUSE Update Bot + +- remove nonsensical org.opencontainers.image.authors - duplication of .vendor + +------------------------------------------------------------------- +Tue Oct 29 15:23:20 UTC 2024 - SUSE Update Bot + +- drop tag_version-%RELEASE% + +------------------------------------------------------------------- +Mon Oct 14 11:26:26 UTC 2024 - SUSE Update Bot + +- make the version-%release tag the first one listed; remove duplicates where they existed; update image.ref/reference to point to the version-%release(-) tag + +------------------------------------------------------------------- +Fri Oct 11 15:12:52 UTC 2024 - SUSE Update Bot + +- make the tag with -%RELEASE% the first tag listed + +------------------------------------------------------------------- +Sat Sep 28 08:15:08 UTC 2024 - Dirk Mueller + +- fix registry references in READMEs + +------------------------------------------------------------------- +Wed Sep 25 17:36:16 UTC 2024 - Dirk Mueller + +- rerender installation step in multiple lines, allow uninstalling optional packages + +------------------------------------------------------------------- +Wed Sep 25 17:12:11 UTC 2024 - Dirk Mueller + +- improved log cleaning + +------------------------------------------------------------------- +Tue Sep 24 20:00:32 UTC 2024 - Dirk Mueller + +- remove release tags for additional_versions + +------------------------------------------------------------------- +Thu Sep 12 10:37:22 UTC 2024 - Dirk Mueller + +- set useobsrepositories explicitly + +------------------------------------------------------------------- +Fri Sep 6 11:30:01 UTC 2024 - Dirk Mueller + +- use full version in version label + +------------------------------------------------------------------- +Fri Aug 16 16:04:02 UTC 2024 - Dirk Mueller + +- Switch to go 1.22 + +------------------------------------------------------------------- +Wed Aug 14 12:30:32 UTC 2024 - Dirk Mueller + +- install packages first + +------------------------------------------------------------------- +Thu Aug 8 19:28:10 UTC 2024 - Dirk Mueller + +- add oci.image.ref.name + +------------------------------------------------------------------- +Thu Aug 8 16:43:43 UTC 2024 - Dirk Mueller + +- remove oci reference annotation again + +------------------------------------------------------------------- +Mon Aug 5 11:38:13 UTC 2024 - Dirk Mueller + +- add OCI reference annotation + +------------------------------------------------------------------- +Sat Aug 3 08:56:51 UTC 2024 - Dirk Mueller + +- set OCI.authors attribute instead of deprecated MAINTAINER + +------------------------------------------------------------------- +Wed Jul 31 12:06:44 UTC 2024 - Dirk Mueller + +- set specific lifecycle url for openSUSE BCI + +------------------------------------------------------------------- +Mon Jul 8 10:31:08 UTC 2024 - Dirk Mueller + +- more upstream-compatible golang containers + +------------------------------------------------------------------- +Fri Jun 28 06:52:02 UTC 2024 - Dirk Mueller + +- add standard devel tools back to development containers + +------------------------------------------------------------------- +Mon Jun 24 23:55:53 UTC 2024 - Dirk Mueller + +- README fixes + +------------------------------------------------------------------- +Tue Jun 18 17:24:16 UTC 2024 - Dirk Mueller + +- use sentence style capitalization in READMEs + +------------------------------------------------------------------- +Mon Jun 10 15:11:25 UTC 2024 - Dirk Mueller + +- update README; reduce unnecessary newlines + +------------------------------------------------------------------- +Wed Jun 5 15:13:27 UTC 2024 - Dirk Mueller + +- Don't add artifacthub labels into labelprefix section + +------------------------------------------------------------------- +Tue Jun 4 12:35:15 UTC 2024 - Alexandre Vicenzi + +- Fix grammar mistake in licensing footer + +------------------------------------------------------------------- +Tue May 28 12:13:17 UTC 2024 - Alexandre Vicenzi + +- Extend README.md + +------------------------------------------------------------------- +Tue May 7 19:07:24 UTC 2024 - Dirk Mueller + +- extend READMEs; correct eula for application images + +------------------------------------------------------------------- +Wed Apr 17 09:30:41 UTC 2024 - Guillaume GARDET + +- fix typo in archexclusiveline + +------------------------------------------------------------------- +Fri Apr 12 12:03:53 UTC 2024 - Dirk Mueller + +- Don't wipe everything in /var/log, only remove log files (this omits directories owned by packages) + +------------------------------------------------------------------- +Wed Feb 7 18:41:00 UTC 2024 - Dan Čermák + +- switch golang stable to 1.22, oldstable to 1.21 + +------------------------------------------------------------------- +Wed Jan 17 14:29:14 UTC 2024 - Dan Čermák + +- Add initial README stub + +------------------------------------------------------------------- +Tue Jan 2 08:26:58 UTC 2024 - Dirk Mueller + +- update year to 2024 + +------------------------------------------------------------------- +Thu Sep 28 14:29:10 UTC 2023 - Dirk Mueller + +- add copyright and description header + +------------------------------------------------------------------- +Thu Sep 28 12:01:58 UTC 2023 - Dirk Mueller + +- correct descriptions to be more consistent + +------------------------------------------------------------------- +Fri Sep 8 12:26:58 UTC 2023 - Dirk Mueller + +- typo fix in last change + +------------------------------------------------------------------- +Wed Sep 6 16:26:08 UTC 2023 - Dirk Mueller + +- install the race subpackage only on architectures where it is available + +------------------------------------------------------------------- +Thu Aug 17 13:41:09 UTC 2023 - Dirk Mueller + +- go 1.21 is now stable, go 1.20 is now oldstable + +------------------------------------------------------------------- +Tue Aug 8 06:51:38 UTC 2023 - Dirk Mueller + +- Add go-doc and go-race subpackages for developer convenience + +------------------------------------------------------------------- +Wed Jul 12 12:55:01 UTC 2023 - Dirk Mueller + +- Remove distribution-release from the package list, it is inherited from the base image + +------------------------------------------------------------------- +Tue Jun 27 15:55:34 UTC 2023 - Dan Čermák + +- Fix reference label + +------------------------------------------------------------------- +Fri Jun 23 15:33:33 UTC 2023 - Dirk Mueller + +- label capitalization and related cleanups + +------------------------------------------------------------------- +Thu Jun 22 16:56:53 UTC 2023 - Dirk Mueller + +- Order the stability buildtag first in the list and prefix them with an stability index to avoid overlaps + +------------------------------------------------------------------- +Tue Jun 13 15:19:20 UTC 2023 - Dirk Müller + +- rename to oldstable + +------------------------------------------------------------------- +Tue May 30 06:52:56 UTC 2023 - Dan Čermák + +- Add release stage and lifecycle url + +------------------------------------------------------------------- +Thu Mar 16 07:29:37 UTC 2023 - Dan Čermák + +- Switch latest to go 1.20 + +------------------------------------------------------------------- +Fri Mar 3 07:24:36 UTC 2023 - Dan Čermák + +- Add org.opencontainers.image.source label set to %SOURCEURL% + +------------------------------------------------------------------- +Wed Dec 21 14:05:34 UTC 2022 - Dirk Müller + +- BuildTag sorting and consistency fixes