Compare commits
31 Commits
7add07006b
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 59f5178cb6 | |||
| 25d24eb8d4 | |||
| 286cfaea5d | |||
| 66dbde0979 | |||
| 57114a0a13 | |||
| d2a7861da9 | |||
| 0b3613c74e | |||
| 0f76c06081 | |||
| c980a6a607 | |||
| 66ebc83e3a | |||
| 90949b12a5 | |||
| 108e3e2949 | |||
| 8d3fe838bb | |||
| 48f8374e21 | |||
| 34d9723f3b | |||
| f2b4e9902a | |||
| 1d224f278b | |||
| 263ead47f7 | |||
| 6923695bb5 | |||
| 47c9a346a2 | |||
| f11d9613cd | |||
| 52e0514d5d | |||
| db328737de | |||
| 316eebcef8 | |||
| 5b2f55b5ad | |||
| 5de188318d | |||
| 59cbe8d46f | |||
| 1cc12fd035 | |||
| 567895f114 | |||
| 981be04298 | |||
| d5eab88d97 |
16
README.md
16
README.md
@@ -1,6 +1,8 @@
|
|||||||
# riscv-docker
|
# 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.
|
[](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:
|
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
|
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
|
### 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
|
- `golang`: An alpine-based image with Go installed
|
||||||
- `webserver`: A very simple webserver
|
- `webserver`: A very simple webserver
|
||||||
- `go-import-redirector`: rsc's [go-import-redirector](https://github.com/rsc/go-import-redirector) project
|
- `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
|
||||||
|
|||||||
9
build.sh
9
build.sh
@@ -1,5 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
# info prints an informational message
|
# info prints an informational message
|
||||||
info() {
|
info() {
|
||||||
echo $'\x1b[32m[INFO]\x1b[0m' "$@"
|
echo $'\x1b[32m[INFO]\x1b[0m' "$@"
|
||||||
@@ -31,6 +33,11 @@ for file in $changed_files; do
|
|||||||
fi
|
fi
|
||||||
done
|
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
|
if [[ "${#changed_directories[@]}" == 0 ]]; then
|
||||||
info "Nothing to do. Exiting..."
|
info "Nothing to do. Exiting..."
|
||||||
exit 0
|
exit 0
|
||||||
@@ -43,7 +50,7 @@ for dir in "${!changed_directories[@]}"; do
|
|||||||
info "Entering ${dir}..."
|
info "Entering ${dir}..."
|
||||||
pushd "${dir}" >/dev/null || error "pushd failed"
|
pushd "${dir}" >/dev/null || error "pushd failed"
|
||||||
info "Executing ${build_script}..."
|
info "Executing ${build_script}..."
|
||||||
# ./build.sh || error "${build_script} failed"
|
./build.sh || error "${build_script} failed"
|
||||||
info "Finished executing ${build_script}"
|
info "Finished executing ${build_script}"
|
||||||
popd >/dev/null || error "popd failed"
|
popd >/dev/null || error "popd failed"
|
||||||
info "Exited ${dir}"
|
info "Exited ${dir}"
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
FROM alpine:edge
|
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 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 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 lure.toml /root/.config/lure/lure.toml
|
||||||
COPY login.sh /bin/registry-login
|
COPY login.sh /bin/registry-login
|
||||||
|
|||||||
5
busybox-root/README.md
Normal file
5
busybox-root/README.md
Normal 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
9
busybox-root/apko.yaml
Normal 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
3
busybox-root/build.sh
Executable 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
3
busybox/README.md
Normal 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
9
busybox/apko.yaml
Normal 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
4
busybox/build.sh
Executable 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
3
crane/README.md
Normal 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
17
crane/build.sh
Executable 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
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
# go-import-redirector
|
# 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
|
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)
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
# golang
|
# 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
|
||||||
|
|||||||
@@ -8,16 +8,6 @@ contents:
|
|||||||
- alpine-base
|
- alpine-base
|
||||||
- go-bin
|
- go-bin
|
||||||
|
|
||||||
accounts:
|
|
||||||
groups:
|
|
||||||
- groupname: nonroot
|
|
||||||
gid: 65532
|
|
||||||
users:
|
|
||||||
- username: nonroot
|
|
||||||
uid: 65532
|
|
||||||
gid: 65532
|
|
||||||
run-as: 65532
|
|
||||||
|
|
||||||
entrypoint:
|
entrypoint:
|
||||||
command: go
|
command: go
|
||||||
|
|
||||||
|
|||||||
@@ -20,4 +20,4 @@ for arch in pkgs/*/; do
|
|||||||
abuild-sign "$arch/APKINDEX.tar.gz"
|
abuild-sign "$arch/APKINDEX.tar.gz"
|
||||||
done
|
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
3
node/README.md
Normal 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
32
node/apko.yaml
Normal 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
7
node/build.sh
Executable 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
7
static-root/README.md
Normal 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
16
static-root/apko.yaml
Normal 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
3
static-root/build.sh
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
apko publish --sbom=false apko.yaml gitea.elara.ws/elara6331/static-root:latest
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
# static
|
# 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
|
This image will only run static binaries (i.e. Go binaries with `CGO_ENABLED=0`) as it doesn't include musl or glibc
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ accounts:
|
|||||||
gid: 65532
|
gid: 65532
|
||||||
run-as: 65532
|
run-as: 65532
|
||||||
|
|
||||||
|
environment:
|
||||||
|
RUNNING_IN_DOCKER: true
|
||||||
|
|
||||||
archs:
|
archs:
|
||||||
- amd64
|
- amd64
|
||||||
- arm64
|
- arm64
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
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
|
||||||
|
|
||||||
|
|||||||
@@ -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.
|
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.
|
You can change the address it listens on using the `WEBSERVER_ADDR` environment variable.
|
||||||
|
|
||||||
This image uses [ko.build](https://ko.build)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user