Skip to content

Commit

Permalink
Merge pull request #1034 from SUSE/for-deploy-Tumbleweed
Browse files Browse the repository at this point in the history
🤖: Update build recipes for Tumbleweed
  • Loading branch information
dirkmueller authored Apr 17, 2024
2 parents 3d5b6ce + b752dd3 commit 54e94e9
Show file tree
Hide file tree
Showing 13 changed files with 509 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .obs/workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@ staging_build:
source_project: home:defolos:BCI:CR:Tumbleweed
source_package: busybox-image
target_project: home:defolos:BCI:CR:Tumbleweed:Staging
- branch_package:
source_project: home:defolos:BCI:CR:Tumbleweed
source_package: gcc-12-image
target_project: home:defolos:BCI:CR:Tumbleweed:Staging
- branch_package:
source_project: home:defolos:BCI:CR:Tumbleweed
source_package: gcc-13-image
target_project: home:defolos:BCI:CR:Tumbleweed:Staging
- branch_package:
source_project: home:defolos:BCI:CR:Tumbleweed
source_package: gcc-14-image
target_project: home:defolos:BCI:CR:Tumbleweed:Staging
- branch_package:
source_project: home:defolos:BCI:CR:Tumbleweed
source_package: git-image
Expand Down Expand Up @@ -210,6 +222,15 @@ refresh_devel_BCI:
- trigger_services:
project: devel:BCI:Tumbleweed
package: busybox-image
- trigger_services:
project: devel:BCI:Tumbleweed
package: gcc-12-image
- trigger_services:
project: devel:BCI:Tumbleweed
package: gcc-13-image
- trigger_services:
project: devel:BCI:Tumbleweed
package: gcc-14-image
- trigger_services:
project: devel:BCI:Tumbleweed
package: git-image
Expand Down
50 changes: 50 additions & 0 deletions gcc-12-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# 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/gcc:12
#!BuildTag: opensuse/bci/gcc:12-%RELEASE%
#!BuildTag: opensuse/bci/gcc:%%gcc_version%%
#!BuildTag: opensuse/bci/gcc:%%gcc_version%%-%RELEASE%

FROM opensuse/tumbleweed:latest

MAINTAINER openSUSE (https://www.opensuse.org/)

# Define labels according to https://en.opensuse.org/Building_derived_containers
# labelprefix=org.opensuse.bci.gcc
LABEL org.opencontainers.image.title="openSUSE Tumbleweed BCI GNU Compiler Collection"
LABEL org.opencontainers.image.description="GNU Compiler Collection container based on the openSUSE Tumbleweed Base Container Image."
LABEL org.opencontainers.image.version="12"
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 io.artifacthub.package.readme-url="https://raw.githubusercontent.com/SUSE/BCI-dockerfile-generator/Tumbleweed/gcc-12-image/README.md"
LABEL org.opensuse.reference="registry.opensuse.org/opensuse/bci/gcc:12-%RELEASE%"
LABEL org.openbuildservice.disturl="%DISTURL%"
LABEL org.opensuse.lifecycle-url="https://en.opensuse.org/Lifetime"
LABEL org.opensuse.release-stage="released"

# endlabelprefix

RUN set -euo pipefail; zypper -n in --no-recommends gcc12 gcc12-c++ make; zypper -n clean; rm -rf /var/log/{lastlog,tallylog,zypper.log,zypp/history,YaST2}
ENV GCC_VERSION="%%gcc_version%%"

# symlink all versioned gcc & g++ binaries to unversioned
# ones in /usr/local/bin so that plain gcc works
RUN set -euo pipefail; for gcc_bin in $(rpm -ql gcc12 gcc12-c++ |grep ^/usr/bin/ ); do \
ln -f $gcc_bin $(echo "$gcc_bin" | sed -e 's|/usr/bin/|/usr/local/bin/|' -e 's|-12$||'); \
done
99 changes: 99 additions & 0 deletions gcc-12-image/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# The GNU Compiler Collection Container Image

The GNU Compiler Collection (GCC) is an optimizing compiler for various
architectures and operating systems. It is the default compiler in the GNU
project and most Linux distributions, including SUSE Linux Enterprise and
openSUSE.


## How to use the image

### Compile an application with a `Dockerfile`

Normally, you'd want to compile an application and distribute it as part of a
custom container image. To do this, create a `Dockerfile` similar to the one
below. The `Dockerfile` uses this image to build a custom container image,
copies the sources to a working directory, and compiles the application:

```Dockerfile
FROM registry.opensuse.org/opensuse/bci/gcc:12
WORKDIR /src/
COPY . /src/
RUN gcc main.c src1.c src2.c
CMD ["./a.out"]
```

It is also possible to compile a static binary with gcc as part of a multistage
build:

```Dockerfile
FROM registry.opensuse.org/opensuse/bci/gcc:12 as builder
WORKDIR /src/
COPY . /src/
RUN gcc -o app main.c src1.c src2.c

FROM registry.suse.com/bci/bci-micro:latest
WORKDIR /build/
COPY --from=builder /src/app /build/
CMD ["/build/app"]
```

Note that you must build a static binary to deploy it into bci-micro; otherwise
shared libraries might be missing. You cannot deploy such an app into a
`scratch` image, as it is not possible to statically link glibc.


### Available build systems

The container image comes with `make` by default. Other build systems and
related utilities are available in the repository, and they can be installed
using `zypper`. This includes the following:
- `meson`
- `cmake`
- `ninja`
- `autoconf` & `automake`


### Available compiler frontends

The GNU Compiler Collections supports a wide range of frontends. The container
image ships the C and C++ frontends available as `gcc` and `g++`
respectively. The following additional frontends can be installed from the
repository:
- `gcc12-fortran` for Fortran support
- `gcc12-ada` for the Ada frontend (GNAT)
- `gcc12-go` for the Go frontend
- `gcc12-objc` and `gcc12-obj-c++` for the Objective C and Objective C++
- `gcc12-d` for the frontend to the D Language


### Using the container image interactively

You can use the image to create ephemeral containers that execute only gcc. This
can be useful in situations, where building a full container image is not
practical. One way to do this is to mount the working directory of an
application into the launched container and compile the application there:

```bash
podman run --rm -it -v $(pwd):/src/:Z registry.opensuse.org/opensuse/bci/gcc:12 \
gcc -o /src/app.out /src/*.c
```
or by invoking `make`
```bash
podman run --rm -it -v $(pwd):/src/:Z --workdir /src/ \
registry.opensuse.org/opensuse/bci/gcc:12 \
make
```

Note that the binary built using this approach are unlikely to work on a local
machine. They only work on operating systems that are binary-compatible to
.

## Licensing
`SPDX-License-Identifier: MIT`

The build recipe and this documentation is 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/).
10 changes: 10 additions & 0 deletions gcc-12-image/_service
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<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">%%gcc_version%%</param>
<param name="package">gcc12</param>
<param name="parse-version">minor</param>
</service>
</services>
4 changes: 4 additions & 0 deletions gcc-12-image/gcc-12-image.changes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-------------------------------------------------------------------
Wed Apr 17 14:34:54 UTC 2024 - SUSE Update Bot <[email protected]>

- First version of the GNU Compiler Collection 12 BCI
45 changes: 45 additions & 0 deletions gcc-13-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# 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/gcc:13
#!BuildTag: opensuse/bci/gcc:13-%RELEASE%
#!BuildTag: opensuse/bci/gcc:%%gcc_version%%
#!BuildTag: opensuse/bci/gcc:%%gcc_version%%-%RELEASE%

FROM opensuse/tumbleweed:latest

MAINTAINER openSUSE (https://www.opensuse.org/)

# Define labels according to https://en.opensuse.org/Building_derived_containers
# labelprefix=org.opensuse.bci.gcc
LABEL org.opencontainers.image.title="openSUSE Tumbleweed BCI GNU Compiler Collection"
LABEL org.opencontainers.image.description="GNU Compiler Collection container based on the openSUSE Tumbleweed Base Container Image."
LABEL org.opencontainers.image.version="13"
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 io.artifacthub.package.readme-url="https://raw.githubusercontent.com/SUSE/BCI-dockerfile-generator/Tumbleweed/gcc-13-image/README.md"
LABEL org.opensuse.reference="registry.opensuse.org/opensuse/bci/gcc:13-%RELEASE%"
LABEL org.openbuildservice.disturl="%DISTURL%"
LABEL org.opensuse.lifecycle-url="https://en.opensuse.org/Lifetime"
LABEL org.opensuse.release-stage="released"

# endlabelprefix

RUN set -euo pipefail; zypper -n in --no-recommends gcc13 gcc13-c++ make gcc gcc-c++; zypper -n clean; rm -rf /var/log/{lastlog,tallylog,zypper.log,zypp/history,YaST2}
ENV GCC_VERSION="%%gcc_version%%"

100 changes: 100 additions & 0 deletions gcc-13-image/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# The GNU Compiler Collection Container Image

The GNU Compiler Collection (GCC) is an optimizing compiler for various
architectures and operating systems. It is the default compiler in the GNU
project and most Linux distributions, including SUSE Linux Enterprise and
openSUSE.


## How to use the image

### Compile an application with a `Dockerfile`

Normally, you'd want to compile an application and distribute it as part of a
custom container image. To do this, create a `Dockerfile` similar to the one
below. The `Dockerfile` uses this image to build a custom container image,
copies the sources to a working directory, and compiles the application:

```Dockerfile
FROM registry.opensuse.org/opensuse/bci/gcc:13
WORKDIR /src/
COPY . /src/
RUN gcc main.c src1.c src2.c
CMD ["./a.out"]
```

It is also possible to compile a static binary with gcc as part of a multistage
build:

```Dockerfile
FROM registry.opensuse.org/opensuse/bci/gcc:13 as builder
WORKDIR /src/
COPY . /src/
RUN gcc -o app main.c src1.c src2.c

FROM registry.suse.com/bci/bci-micro:latest
WORKDIR /build/
COPY --from=builder /src/app /build/
CMD ["/build/app"]
```

Note that you must build a static binary to deploy it into bci-micro; otherwise
shared libraries might be missing. You cannot deploy such an app into a
`scratch` image, as it is not possible to statically link glibc.


### Available build systems

The container image comes with `make` by default. Other build systems and
related utilities are available in the repository, and they can be installed
using `zypper`. This includes the following:
- `meson`
- `cmake`
- `ninja`
- `autoconf` & `automake`


### Available compiler frontends

The GNU Compiler Collections supports a wide range of frontends. The container
image ships the C and C++ frontends available as `gcc` and `g++`
respectively. The following additional frontends can be installed from the
repository:
- `gcc13-fortran` for Fortran support
- `gcc13-ada` for the Ada frontend (GNAT)
- `gcc13-go` for the Go frontend
- `gcc13-objc` and `gcc13-obj-c++` for the Objective C and Objective C++
- `gcc13-d` for the frontend to the D Language
- `gcc13-m2` for the Modula 2 compiler frontend


### Using the container image interactively

You can use the image to create ephemeral containers that execute only gcc. This
can be useful in situations, where building a full container image is not
practical. One way to do this is to mount the working directory of an
application into the launched container and compile the application there:

```bash
podman run --rm -it -v $(pwd):/src/:Z registry.opensuse.org/opensuse/bci/gcc:13 \
gcc -o /src/app.out /src/*.c
```
or by invoking `make`
```bash
podman run --rm -it -v $(pwd):/src/:Z --workdir /src/ \
registry.opensuse.org/opensuse/bci/gcc:13 \
make
```

Note that the binary built using this approach are unlikely to work on a local
machine. They only work on operating systems that are binary-compatible to
.

## Licensing
`SPDX-License-Identifier: MIT`

The build recipe and this documentation is 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/).
10 changes: 10 additions & 0 deletions gcc-13-image/_service
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<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">%%gcc_version%%</param>
<param name="package">gcc13</param>
<param name="parse-version">minor</param>
</service>
</services>
4 changes: 4 additions & 0 deletions gcc-13-image/gcc-13-image.changes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-------------------------------------------------------------------
Wed Apr 17 14:34:54 UTC 2024 - SUSE Update Bot <[email protected]>

- First version of the GNU Compiler Collection 13 BCI
Loading

0 comments on commit 54e94e9

Please sign in to comment.