Compare commits

..

31 Commits

Author SHA1 Message Date
59f5178cb6 Add RUNNING_IN_DOCKER env variable
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2025-02-11 18:25:21 -08:00
25d24eb8d4 Update busybox-root/README.md
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2024-03-12 21:54:02 +00:00
286cfaea5d Set correct image names
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2024-03-12 14:51:51 -07:00
66dbde0979 Add static-root and busybox-root containers
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2024-03-12 14:50:24 -07:00
57114a0a13 Update LURE in builder image
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-10-08 17:37:58 -07:00
d2a7861da9 Update README [skip ci] 2023-09-28 16:46:33 +00:00
0b3613c74e Set the go version tag manually
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-09-28 06:26:21 +00:00
0f76c06081 Clarify README
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/manual/woodpecker Pipeline was successful
2023-08-16 13:47:48 -07:00
c980a6a607 Clarify crane README
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-08-16 13:02:51 -07:00
66ebc83e3a Add entrypoint to busybox image
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-08-16 12:59:30 -07:00
90949b12a5 Add new images to README 2023-08-16 12:58:44 -07:00
108e3e2949 Add crane image
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-08-16 12:25:36 -07:00
8d3fe838bb Add busybox image
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-08-16 12:21:13 -07:00
48f8374e21 Add ca-certificates to node image
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-08-16 12:07:45 -07:00
34d9723f3b Remove nonroot user from node image
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-08-16 12:04:23 -07:00
f2b4e9902a Add npm to the node image and upgrade to nodejs-current
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-08-16 12:03:01 -07:00
1d224f278b Add a node image
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-08-15 20:30:35 -07:00
263ead47f7 Add a way to force build a container
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-08-15 13:11:51 -07:00
6923695bb5 Add version tag to golang
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-08-14 22:48:26 -07:00
47c9a346a2 Add yq to builder image 2023-08-14 22:44:40 -07:00
f11d9613cd Fix static build.sh
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-08-14 09:51:59 -07:00
52e0514d5d Remove nonroot user from golang image
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2023-08-14 09:49:42 -07:00
db328737de Fix typo [skip ci] 2023-08-14 04:29:32 +00:00
316eebcef8 Remove note about ko.build
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-08-13 20:29:25 -07:00
5b2f55b5ad Add CI status badge to README
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-08-13 20:27:38 -07:00
5de188318d Add acknowledgements to README
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-08-13 19:11:01 -07:00
59cbe8d46f Remove note about ko.build
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-08-13 19:05:43 -07:00
1cc12fd035 Add static to list of images in README
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-08-13 19:01:22 -07:00
567895f114 Clarify README
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-08-13 18:48:17 -07:00
981be04298 Run build scripts in build.sh
Some checks failed
ci/woodpecker/manual/woodpecker Pipeline failed
2023-08-13 18:44:15 -07:00
d5eab88d97 Add set -e flag to build.sh 2023-08-13 18:43:37 -07:00
25 changed files with 157 additions and 24 deletions

View File

@@ -1,6 +1,8 @@
# riscv-docker
This repo contains custom docker images that I'm using for my cluster. You can find the containers I build from these in the [Packages](https://gitea.elara.ws/Elara6331/riscv-docker/packages) section of this repo.
[![status-badge](https://ci.elara.ws/api/badges/51/status.svg)](https://ci.elara.ws/repos/51)
This repo contains build scripts for custom docker images that I'm using for my cluster. You can find the containers that are automatically built from these in the [Packages](https://gitea.elara.ws/Elara6331/riscv-docker/packages) section of this repo.
The containers are stored on my gitea instance, so you can pull them like this:
@@ -8,10 +10,20 @@ The containers are stored on my gitea instance, so you can pull them like this:
docker pull gitea.elara.ws/elara6331/golang:latest
```
Some of the images use [ko.build](https://ko.build)
Read my article [here](https://www.elara.ws/articles/riscv-cluster)!
### Images
- `static`: A base image with just enough files to run static binaries
- `busybox`: A base image with the busybox utilities installed
- `golang`: An alpine-based image with Go installed
- `webserver`: A very simple webserver
- `go-import-redirector`: rsc's [go-import-redirector](https://github.com/rsc/go-import-redirector) project
- `node`: An alpine-based image with NodeJS and npm installed
- `crane`: Google's [crane](https://github.com/google/go-containerregistry/tree/main/cmd/crane) project
### Acknowledgements
- [Alpine Linux](https://alpinelinux.org/): The basis of all my images
- [ko](https://ko.build/): Used to build light containers with static Go programs
- [apko](https://github.com/chainguard-dev/apko): Used to build more complex containers

View File

@@ -1,5 +1,7 @@
#!/bin/bash
set -e
# info prints an informational message
info() {
echo $'\x1b[32m[INFO]\x1b[0m' "$@"
@@ -31,6 +33,11 @@ for file in $changed_files; do
fi
done
# Check if FORCE_BUILD is set and add the directory inside to changed_directories if it is
if [ -n "${FORCE_BUILD}" ]; then
changed_directories["${FORCE_BUILD}"]=1
fi
if [[ "${#changed_directories[@]}" == 0 ]]; then
info "Nothing to do. Exiting..."
exit 0
@@ -43,7 +50,7 @@ for dir in "${!changed_directories[@]}"; do
info "Entering ${dir}..."
pushd "${dir}" >/dev/null || error "pushd failed"
info "Executing ${build_script}..."
# ./build.sh || error "${build_script} failed"
./build.sh || error "${build_script} failed"
info "Finished executing ${build_script}"
popd >/dev/null || error "popd failed"
info "Exited ${dir}"

View File

@@ -1,7 +1,10 @@
FROM alpine:edge
RUN apk add --no-cache go git gcc bash abuild
RUN apk add --no-cache go yq git gcc bash abuild
RUN apk add --no-cache ko --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing
RUN apk add --no-cache --allow-untrusted apko --repository=https://packages.wolfi.dev/os
RUN wget -O /usr/bin/lure https://api.minio.elara.ws/adl/lure/lure-amd64 && chmod +x /usr/bin/lure
RUN wget -O lure.tar.gz https://gitea.elara.ws/lure/lure/releases/download/v0.1.2/lure-0.1.2-linux-x86_64.tar.gz && \
tar xvf lure.tar.gz && \
install -Dm755 lure /usr/bin/lure && \
rm -r lure scripts
COPY lure.toml /root/.config/lure/lure.toml
COPY login.sh /bin/registry-login

5
busybox-root/README.md Normal file
View File

@@ -0,0 +1,5 @@
# busybox-root
The [busybox-root image](https://gitea.elara.ws/Elara6331/-/packages/container/busybox-root/latest) is a basic image with the busybox utilities installed.
This image runs as root. See [busybox](https://gitea.elara.ws/Elara6331/riscv-docker/src/branch/master/busybox) for a rootless container.

9
busybox-root/apko.yaml Normal file
View File

@@ -0,0 +1,9 @@
include: gitea.elara.ws/elara6331/riscv-docker/static-root/apko.yaml@master
contents:
packages:
- busybox
- ssl_client
entrypoint:
command: /bin/sh

3
busybox-root/build.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
set -e
apko publish --sbom=false apko.yaml gitea.elara.ws/elara6331/busybox-root:latest

3
busybox/README.md Normal file
View File

@@ -0,0 +1,3 @@
# busybox
The [busybox image](https://gitea.elara.ws/Elara6331/-/packages/container/busybox/latest) is a basic image with the busybox utilities installed.

9
busybox/apko.yaml Normal file
View File

@@ -0,0 +1,9 @@
include: gitea.elara.ws/elara6331/riscv-docker/static/apko.yaml@master
contents:
packages:
- busybox
- ssl_client
entrypoint:
command: /bin/sh

4
busybox/build.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
set -e
apko publish --sbom=false apko.yaml gitea.elara.ws/elara6331/busybox:latest

3
crane/README.md Normal file
View File

@@ -0,0 +1,3 @@
# crane
The [crane](https://gitea.elara.ws/Elara6331/-/packages/container/crane/latest) image contains Google's [crane](https://github.com/google/go-containerregistry/tree/main/cmd/crane) project. It comes with `/bin/sh` unlike Google's official image, so it's useful for programs such as Woodpecker CI, which depend on a shell being available.

17
crane/build.sh Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/bash
set -e
# Clone go-containerregistry and enter crane's directory
git clone --depth=1 https://github.com/google/go-containerregistry.git
pushd go-containerregistry/cmd/crane
# Build and publish the image
KO_DOCKER_REPO=gitea.elara.ws/elara6331 \
KO_DEFAULTBASEIMAGE=gitea.elara.ws/elara6331/busybox \
ko build -B \
--platform=linux/amd64,linux/arm64,linux/riscv64 \
--sbom=none
# Leave crane's directory
popd

View File

@@ -1,5 +1,3 @@
# go-import-redirector
The [go-import-redirector](https://gitea.elara.ws/Elara6331/-/packages/container/go-import-redirector/latest) image contains rsc's [go-import-redirector](https://github.com/rsc/go-import-redirector) project
This image uses [ko.build](https://ko.build)
The [go-import-redirector](https://gitea.elara.ws/Elara6331/-/packages/container/go-import-redirector/latest) image contains rsc's [go-import-redirector](https://github.com/rsc/go-import-redirector) project.

View File

@@ -1,3 +1,3 @@
# golang
The [golang image](https://gitea.elara.ws/Elara6331/-/packages/container/golang/latest) is an Alpine Edge image with the latest version of Go installed
The [golang image](https://gitea.elara.ws/Elara6331/-/packages/container/golang/latest) is an Alpine Edge image with the latest version of Go from LURE's [go-bin package](https://lure.elara.ws/pkg/default/go-bin) installed

View File

@@ -8,16 +8,6 @@ contents:
- alpine-base
- go-bin
accounts:
groups:
- groupname: nonroot
gid: 65532
users:
- username: nonroot
uid: 65532
gid: 65532
run-as: 65532
entrypoint:
command: go

View File

@@ -20,4 +20,4 @@ for arch in pkgs/*/; do
abuild-sign "$arch/APKINDEX.tar.gz"
done
apko publish --sbom=false apko.yaml gitea.elara.ws/elara6331/golang:latest
apko publish --sbom=false apko.yaml gitea.elara.ws/elara6331/golang:latest gitea.elara.ws/elara6331/golang:1.21.1

3
node/README.md Normal file
View File

@@ -0,0 +1,3 @@
# node
The [node image](https://gitea.elara.ws/Elara6331/-/packages/container/node/latest) is an Alpine Edge image with the latest version of NodeJS from Alpine's [nodejs package](https://pkgs.alpinelinux.org/package/edge/main/riscv64/nodejs) installed

32
node/apko.yaml Normal file
View File

@@ -0,0 +1,32 @@
contents:
repositories:
- https://dl-cdn.alpinelinux.org/alpine/edge/main
- https://dl-cdn.alpinelinux.org/alpine/edge/community
packages:
- busybox
- alpine-release
- ca-certificates-bundle
- nghttp2
- nodejs-current
- npm
paths:
- path: /app
type: directory
permissions: 0o777
work-dir: /app
environment:
NODE_PORT: 3000
PATH: '/usr/sbin:/sbin:/usr/bin:/bin'
NPM_CONFIG_UPDATE_NOTIFIER: false
entrypoint:
command: /usr/bin/node
cmd: --help
archs:
- amd64
- arm64
- riscv64

7
node/build.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
set -e
apko publish \
--sbom=false \
--package-version-tag=nodejs-current \
apko.yaml \
gitea.elara.ws/elara6331/node:latest

7
static-root/README.md Normal file
View File

@@ -0,0 +1,7 @@
# static-root
The [static-root image](https://gitea.elara.ws/Elara6331/-/packages/container/static-root/latest) is a basic image with just enough files to run static binaries. It's meant to be used as a base image and is useless outside of that.
This image will only run static binaries (i.e. Go binaries with `CGO_ENABLED=0`) as it doesn't include musl or glibc
This image runs as root. See [static](https://gitea.elara.ws/Elara6331/riscv-docker/src/branch/master/static) for a rootless container.

16
static-root/apko.yaml Normal file
View File

@@ -0,0 +1,16 @@
contents:
repositories:
- https://dl-cdn.alpinelinux.org/alpine/edge/main
packages:
- alpine-baselayout-data
- alpine-release
- ca-certificates-bundle
- tzdata
environment:
RUNNING_IN_DOCKER: true
archs:
- amd64
- arm64
- riscv64

3
static-root/build.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
set -e
apko publish --sbom=false apko.yaml gitea.elara.ws/elara6331/static-root:latest

View File

@@ -1,5 +1,5 @@
# static
The [static image](https://gitea.elara.ws/Elara6331/-/packages/container/static/latest) is a basic image with just enough iles to run static binaries. It's meant to be used as a base image and is useless outside of that.
The [static image](https://gitea.elara.ws/Elara6331/-/packages/container/static/latest) is a basic image with just enough files to run static binaries. It's meant to be used as a base image and is useless outside of that.
This image will only run static binaries (i.e. Go binaries with `CGO_ENABLED=0`) as it doesn't include musl or glibc

View File

@@ -17,6 +17,9 @@ accounts:
gid: 65532
run-as: 65532
environment:
RUNNING_IN_DOCKER: true
archs:
- amd64
- arm64

View File

@@ -1,3 +1,4 @@
#!/bin/bash
set -e
apko publish --sbom=false apko.yaml gitea.elra.ws/elara6331/static:latest
apko publish --sbom=false apko.yaml gitea.elara.ws/elara6331/static:latest

View File

@@ -3,5 +3,3 @@
The [webserver image](https://gitea.elara.ws/Elara6331/-/packages/container/webserver/latest) is a very simple webserver that serves its `/html` directory and logs requests. It doesn't have any TLS capabilities or anything like that, it just serves some static files and does nothing else.
You can change the address it listens on using the `WEBSERVER_ADDR` environment variable.
This image uses [ko.build](https://ko.build)