initial commit

This commit is contained in:
ThetaDev 2024-03-01 21:36:21 +01:00
commit e269558889
Signed by: ThetaDev
GPG key ID: E319D3C5148D65B6
2 changed files with 95 additions and 0 deletions

34
README.md Normal file
View file

@ -0,0 +1,34 @@
# gitea-ci
Building docker images for Gitea Actions
## `thetadev256/cimaster`
Default image for my Gitea Actions servers.
**Base image:** `node:21-bookworm`
### Languages
- gcc (v12)
- Node.JS (v21)
- Python (3.11)
- Golang (latest stable, installed from https://go.dev/dl)
- Rust (latest stable, installed using rustup)
### Development tools
- [`yarn`](https://yarnpkg.com/) Node package manager
- [`pnpm`](https://pnpm.io/) Best node package manager
- [`tsx`](https://github.com/privatenumber/tsx) Run Typescript files directly
- [`git-cliff`](https://github.com/orhun/git-cliff) Changelog generator
- [`just`](https://github.com/casey/just/) Command runner, written in Rust
- [`task`](https://github.com/go-task/task) Command runner, written in Go
- [`pre-commit`](https://github.com/pre-commit/pre-commit) Runner for pre-commit hooks
- [`mdbook`](https://github.com/rust-lang/mdBook) Dokumentation generator
### System tools
- HTTP: `curl`, `wget`
- Compression: `zip`, `gzip`, `xz`, `zstd`, `brotli`
- Version control: `git`, `svn`

61
cimaster/Dockerfile Normal file
View file

@ -0,0 +1,61 @@
FROM node:21-bookworm
# Install golang (Source: https://github.com/docker-library/golang)
RUN set -eux; \
arch="$(dpkg --print-architecture)"; arch="${arch##*-}"; \
url=; \
case "$arch" in \
'amd64') \
url='https://dl.google.com/go/go1.22.0.linux-amd64.tar.gz'; \
sha256='f6c8a87aa03b92c4b0bf3d558e28ea03006eb29db78917daec5cfb6ec1046265'; \
;; \
'armhf') \
url='https://dl.google.com/go/go1.22.0.linux-armv6l.tar.gz'; \
sha256='0525f92f79df7ed5877147bce7b955f159f3962711b69faac66bc7121d36dcc4'; \
;; \
'arm64') \
url='https://dl.google.com/go/go1.22.0.linux-arm64.tar.gz'; \
sha256='6a63fef0e050146f275bf02a0896badfe77c11b6f05499bb647e7bd613a45a10'; \
;; \
*) echo >&2 "error: unsupported architecture '$arch' (likely packaging update needed)"; exit 1 ;; \
esac; \
\
wget -O go.tgz.asc "$url.asc"; \
wget -O go.tgz "$url" --progress=dot:giga; \
echo "$sha256 *go.tgz" | sha256sum -c -; \
\
# https://github.com/golang/go/issues/14739#issuecomment-324767697
GNUPGHOME="$(mktemp -d)"; export GNUPGHOME; \
# https://www.google.com/linuxrepositories/
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 'EB4C 1BFD 4F04 2F6D DDCC EC91 7721 F63B D38B 4796'; \
# let's also fetch the specific subkey of that key explicitly that we expect "go.tgz.asc" to be signed by, just to make sure we definitely have it
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys '2F52 8D36 D67B 69ED F998 D857 78BD 6547 3CB3 BD13'; \
gpg --batch --verify go.tgz.asc go.tgz; \
gpgconf --kill all; \
rm -rf "$GNUPGHOME" go.tgz.asc; \
\
tar -C /usr/local -xzf go.tgz; \
rm go.tgz; \
\
/usr/local/go/bin/go version
# Install other tools
RUN set -eux; \
curl -SsL --output /usr/share/keyrings/thetadev.gpg "https://thetadev.de/repo/thetadev.gpg"; \
echo "deb [signed-by=/usr/share/keyrings/thetadev.gpg] https://thetadev.de/repo universal main\ndeb [signed-by=/usr/share/keyrings/thetadev.gpg] https://thetadev.de/repo bookworm main" > /etc/apt/sources.list.d/thetadev.list; \
apt-get update; \
apt-get upgrade -y; \
apt-get install -y sudo python-is-python3 zip zstd brotli rustup git-cliff just task pre-commit mdbook; \
apt-get clean; \
npm install -g pnpm tsx
# User setup
RUN useradd -m ci && echo 'ci ALL=(ALL:ALL) NOPASSWD:ALL' >> /etc/sudoers
USER ci
# Install Rust
RUN set -eux; \
rustup install stable; \
rustup target add x86_64-unknown-linux-gnu x86_64-unknown-linux-musl aarch64-unknown-linux-gnu aarch64-unknown-linux-musl
ENV PATH /usr/local/go/bin:/home/ci/go/bin:/home/ci/.cargo/bin:$PATH