[info=95d7ab65640c4a63682a9dd5f8924b3a]

OBS-URL: https://build.opensuse.org/package/show/devel:BCI:Tumbleweed/golang-stable-image?expand=0&rev=156
This commit is contained in:
Dan Čermák 2024-09-06 17:47:18 +00:00 committed by Git OBS Bridge
commit 30a0de244d
7 changed files with 407 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -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

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

58
Dockerfile Normal file
View File

@ -0,0 +1,58 @@
# 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
#!BuildTag: opensuse/bci/golang:stable
#!BuildTag: opensuse/bci/golang:stable-1.%RELEASE%
#!BuildTag: opensuse/bci/golang:1.23
#!BuildTag: opensuse/bci/golang:1.23-1.%RELEASE%
#!BuildTag: opensuse/bci/golang:%%golang_version%%
#!BuildTag: opensuse/bci/golang:%%golang_version%%-1.%RELEASE%
#!BuildTag: opensuse/bci/golang:latest
FROM opensuse/tumbleweed:latest
RUN set -euo pipefail; zypper -n in --no-recommends go1.23 go1.23-doc make curl findutils gawk git-core procps util-linux; zypper -n clean; rm -rf /var/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.authors="openSUSE (https://www.opensuse.org/)"
LABEL org.opencontainers.image.title="openSUSE Tumbleweed BCI Go 1.23 development"
LABEL org.opencontainers.image.description="Go 1.23 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="1.23-1.%RELEASE%"
LABEL org.opensuse.reference="registry.opensuse.org/opensuse/bci/golang:1.23-1.%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-stable-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.23-race; then zypper -n clean; fi
RUN set -euo pipefail; install -m 755 -d /go/bin /go/src
RUN set -euo pipefail; rm -rf /var/log/{lastlog,tallylog,zypper.log,zypp/history,YaST2}
WORKDIR /go

135
README.md Normal file
View File

@ -0,0 +1,135 @@
# Go 1.23 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.23 development container image
FROM registry.opensuse.org/opensuse/bci/golang:1.23 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.23 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.23 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.23 development Container Image
FROM registry.opensuse.org/opensuse/bci/golang:1.23 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.suse.com/bci/bci-micro:15.4
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.23-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/).

7
_constraints Normal file
View File

@ -0,0 +1,7 @@
<constraints>
<hardware>
<disk>
<size unit="G">8</size>
</disk>
</hardware>
</constraints>

9
_service Normal file
View File

@ -0,0 +1,9 @@
<services>
<service mode="buildtime" name="docker_label_helper"/>
<service mode="buildtime" name="kiwi_metainfo_helper"/>
<service name="replace_using_package_version" mode="buildtime">
<param name="file">Dockerfile</param>
<param name="regex">%%golang_version%%</param>
<param name="package">go1.23</param>
</service>
</services>

174
golang-stable-image.changes Normal file
View File

@ -0,0 +1,174 @@
-------------------------------------------------------------------
Fri Sep 6 11:30:01 UTC 2024 - Dirk Mueller <dmueller@suse.com>
- use full version in version label
-------------------------------------------------------------------
Fri Aug 16 16:04:16 UTC 2024 - Dirk Mueller <dmueller@suse.com>
- Switch to go 1.23
-------------------------------------------------------------------
Wed Aug 14 12:30:32 UTC 2024 - Dirk Mueller <dmueller@suse.com>
- install packages first
-------------------------------------------------------------------
Thu Aug 8 19:28:10 UTC 2024 - Dirk Mueller <dmueller@suse.com>
- add oci.image.ref.name
-------------------------------------------------------------------
Thu Aug 8 16:43:43 UTC 2024 - Dirk Mueller <dmueller@suse.com>
- remove oci reference annotation again
-------------------------------------------------------------------
Mon Aug 5 11:38:13 UTC 2024 - Dirk Mueller <dmueller@suse.com>
- add OCI reference annotation
-------------------------------------------------------------------
Sat Aug 3 08:56:51 UTC 2024 - Dirk Mueller <dmueller@suse.com>
- set OCI.authors attribute instead of deprecated MAINTAINER
-------------------------------------------------------------------
Wed Jul 31 12:06:44 UTC 2024 - Dirk Mueller <dmueller@suse.com>
- set specific lifecycle url for openSUSE BCI
-------------------------------------------------------------------
Mon Jul 8 10:31:08 UTC 2024 - Dirk Mueller <dmueller@suse.com>
- more upstream-compatible golang containers
-------------------------------------------------------------------
Fri Jun 28 06:52:02 UTC 2024 - Dirk Mueller <dmueller@suse.com>
- add standard devel tools back to development containers
-------------------------------------------------------------------
Mon Jun 24 23:55:53 UTC 2024 - Dirk Mueller <dmueller@suse.com>
- README fixes
-------------------------------------------------------------------
Tue Jun 18 17:24:16 UTC 2024 - Dirk Mueller <dmueller@suse.com>
- use sentence style capitalization in READMEs
-------------------------------------------------------------------
Mon Jun 10 15:11:25 UTC 2024 - Dirk Mueller <dmueller@suse.com>
- update README; reduce unnecessary newlines
-------------------------------------------------------------------
Wed Jun 5 15:13:27 UTC 2024 - Dirk Mueller <dmueller@suse.com>
- Don't add artifacthub labels into labelprefix section
-------------------------------------------------------------------
Tue Jun 4 12:35:15 UTC 2024 - Alexandre Vicenzi <alexandre.vicenzi@suse.com>
- Fix grammar mistake in licensing footer
-------------------------------------------------------------------
Tue May 28 12:13:17 UTC 2024 - Alexandre Vicenzi <alexandre.vicenzi@suse.com>
- Extend README.md
-------------------------------------------------------------------
Tue May 7 19:07:24 UTC 2024 - Dirk Mueller <dmueller@suse.com>
- extend READMEs; correct eula for application images
-------------------------------------------------------------------
Wed Apr 17 09:30:41 UTC 2024 - Guillaume GARDET <guillaume.gardet@oliseo.fr>
- fix typo in archexclusiveline
-------------------------------------------------------------------
Fri Apr 12 12:03:53 UTC 2024 - Dirk Mueller <dmueller@suse.com>
- 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 <dcermak@suse.com>
- switch golang stable to 1.22, oldstable to 1.21
-------------------------------------------------------------------
Wed Jan 17 14:29:14 UTC 2024 - Dan Čermák <dcermak@suse.com>
- Add initial README stub
-------------------------------------------------------------------
Tue Jan 2 08:26:58 UTC 2024 - Dirk Mueller <dmueller@suse.com>
- update year to 2024
-------------------------------------------------------------------
Thu Sep 28 14:29:10 UTC 2023 - Dirk Mueller <dmueller@suse.com>
- add copyright and description header
-------------------------------------------------------------------
Thu Sep 28 12:01:58 UTC 2023 - Dirk Mueller <dmueller@suse.com>
- correct descriptions to be more consistent
-------------------------------------------------------------------
Fri Sep 8 12:26:59 UTC 2023 - Dirk Mueller <dmueller@suse.com>
- typo fix in last change
-------------------------------------------------------------------
Wed Sep 6 16:26:08 UTC 2023 - Dirk Mueller <dmueller@suse.com>
- install the race subpackage only on architectures where it is available
-------------------------------------------------------------------
Thu Aug 17 13:41:09 UTC 2023 - Dirk Mueller <dmueller@suse.com>
- go 1.21 is now stable, go 1.20 is now oldstable
-------------------------------------------------------------------
Tue Aug 8 06:51:38 UTC 2023 - Dirk Mueller <dmueller@suse.com>
- Add go-doc and go-race subpackages for developer convenience
-------------------------------------------------------------------
Wed Jul 12 12:55:01 UTC 2023 - Dirk Mueller <dmueller@suse.com>
- 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 <dcermak@suse.com>
- Fix reference label
-------------------------------------------------------------------
Fri Jun 23 15:33:33 UTC 2023 - Dirk Mueller <dmueller@suse.com>
- label capitalization and related cleanups
-------------------------------------------------------------------
Thu Jun 22 16:56:53 UTC 2023 - Dirk Mueller <dmueller@suse.com>
- Order the stability buildtag first in the list and prefix them with an stability index to avoid overlaps
-------------------------------------------------------------------
Tue Jun 13 15:19:02 UTC 2023 - Dirk Müller <dmueller@suse.com>
- rename to stable
-------------------------------------------------------------------
Tue May 30 06:52:56 UTC 2023 - Dan Čermák <dcermak@suse.com>
- Add release stage and lifecycle url
-------------------------------------------------------------------
Thu Mar 16 07:23:29 UTC 2023 - SUSE Update Bot <bci-internal@suse.de>
- First version of the Golang 1.20 BCI