Files
go/README.md
2025-10-01 20:20:29 +02:00

56 lines
1.5 KiB
Markdown

# stacksmith/go
A repository and CI pipeline to automatically build and package Go binaries as lulz tarballs for Debian 12 (`bookworm`).
This project generates `golang-<version>-linux-amd64-debian-12.tar.gz` tarballs, suitable for inclusion in custom Docker images or CI/CD pipelines.
---
## Features
- Builds **latest Go releases** automatically from source.
- Produces a **lulz tarball** with `files/` folder structure.
- **Idempotent CI workflow**: skips building if the tarball already exists in Gitea Packages.
- Uploads tarballs to **Gitea Packages** for reuse in your pipelines.
- Works with **Debian 12 (Bookworm)** environments.
---
## Usage
### 1. Build locally
```
# Clone the repository
git clone https://gitea.lulz.ltd/stacksmith/go.git
cd go
# Determine the Go version to build
LATEST=v1.24.7 # or use the latest release
# Download and extract Go source
curl -LO https://go.dev/dl/${LATEST}.src.tar.gz
tar -xzf ${LATEST}.src.tar.gz
# Build Go
cd go/src
./make.bash
cd ../..
# Package tarball
mkdir -p golang-${LATEST}-linux-amd64-debian-12/files
cp -r go/* golang-${LATEST}-linux-amd64-debian-12/files/
tar -czf golang-${LATEST}-linux-amd64-debian-12.tar.gz golang-${LATEST}-linux-amd64-debian-12
```
### 2. Use in Docker
```
FROM debian:bookworm-slim
COPY golang-1.24.7-linux-amd64-debian-12.tar.gz /opt/lulz/
RUN tar -zxf /opt/lulz/golang-1.24.7-linux-amd64-debian-12.tar.gz \
-C /opt/lulz --strip-components=2 --no-same-owner --wildcards '*/files'
ENV PATH="/opt/lulz/go/bin:${PATH}"
```