Skip to content

Commit

Permalink
feat: switch to baseless apps (#992)
Browse files Browse the repository at this point in the history
  • Loading branch information
onedr0p authored Apr 8, 2024
1 parent 592bf65 commit 364b303
Show file tree
Hide file tree
Showing 55 changed files with 366 additions and 445 deletions.
8 changes: 2 additions & 6 deletions .github/scripts/prepare-matrices.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def get_image_metadata(subdir, meta, forRelease=False, force=False, channels=Non

# Image Tags
toBuild["tags"] = ["rolling", version]
if meta.get("semantic_versioning", False):
if meta.get("semver", False):
parts = version.split(".")[:-1]
while len(parts) > 0:
toBuild["tags"].append(".".join(parts))
Expand All @@ -125,11 +125,7 @@ def get_image_metadata(subdir, meta, forRelease=False, force=False, channels=Non
platformToBuild["target_arch"] = target_arch
platformToBuild["version"] = version
platformToBuild["channel"] = channel["name"]

if meta.get("base", False):
platformToBuild["label_type"] ="org.opencontainers.image.base"
else:
platformToBuild["label_type"]="org.opencontainers.image"
platformToBuild["label_type"]="org.opencontainers.image"

if isfile(os.path.join(subdir, channel["name"], "Dockerfile")):
platformToBuild["dockerfile"] = os.path.join(subdir, channel["name"], "Dockerfile")
Expand Down
9 changes: 3 additions & 6 deletions .github/scripts/render-readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ def load_metadata_file(file_path):
return None

if __name__ == "__main__":
base_images = []
app_images = []
for subdir, dirs, files in os.walk("./apps"):
for file in files:
Expand All @@ -48,11 +47,9 @@ def load_metadata_file(file_path):
"html_url": f"https://github.com/{repo_name}/pkgs/container/{name}",
"owner": repo_owner
}
if meta["base"]:
base_images.append(image)
else:
app_images.append(image)

app_images.append(image)

template = env.get_template("README.md.j2")
with open("./README.md", "w") as f:
f.write(template.render(base_images=base_images, app_images=app_images))
f.write(template.render(app_images=app_images))
20 changes: 8 additions & 12 deletions .github/scripts/templates/README.md.j2
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ _An opinionated collection of container images_

</div>

Welcome to our container images, if looking for a container start by [browsing the GitHub Packages page for this repo's packages](https://github.com/onedr0p?tab=packages&repo_name=containers).
Welcome to my container images, if looking for a container start by [browsing the GitHub Packages page for this repo's packages](https://github.com/onedr0p?tab=packages&repo_name=containers).

## Mission statement

The goal of this project is to support [semantically versioned](https://semver.org/), [rootless](https://rootlesscontaine.rs/), and [multiple architecture](https://www.docker.com/blog/multi-arch-build-and-images-the-simple-way/) containers for various applications.

We also try to adhere to a [KISS principle](https://en.wikipedia.org/wiki/KISS_principle), logging to stdout, [one process per container](https://testdriven.io/tips/59de3279-4a2d-4556-9cd0-b444249ed31e/), no [s6-overlay](https://github.com/just-containers/s6-overlay) and all images are built on top of [Alpine](https://hub.docker.com/_/alpine) or [Ubuntu](https://hub.docker.com/_/ubuntu).
It also adheres to a [KISS principle](https://en.wikipedia.org/wiki/KISS_principle), logging to stdout, [one process per container](https://testdriven.io/tips/59de3279-4a2d-4556-9cd0-b444249ed31e/), no [s6-overlay](https://github.com/just-containers/s6-overlay) and all images are built on top of [Alpine](https://hub.docker.com/_/alpine) or [Ubuntu](https://hub.docker.com/_/ubuntu).

## Tag immutability

Expand Down Expand Up @@ -89,16 +89,12 @@ Container | Channel | Image

Here's an example of how tags are created in the GitHub workflows, be careful with `metadata.json` as it does affect the outcome of how the tags will be created when the application is built.

| Application | Channel | Stable | Base | Generated Tag |
|-------------|-----------|---------|---------|-----------------------------|
| `ubuntu` | `focal` | `true` | `true` | `ubuntu:focal-rolling` |
| `ubuntu` | `focal` | `true` | `true` | `ubuntu:focal-19880312` |
| `alpine` | `3.16` | `true` | `true` | `alpine:rolling` |
| `alpine` | `3.16` | `true` | `true` | `alpine:3.16.0` |
| `sonarr` | `develop` | `false` | `false` | `sonarr-develop:3.0.8.1538` |
| `sonarr` | `develop` | `false` | `false` | `sonarr-develop:rolling` |
| `sonarr` | `main` | `true` | `false` | `sonarr:3.0.8.1507` |
| `sonarr` | `main` | `true` | `false` | `sonarr:rolling` |
| Application | Channel | Stable | Generated Tag |
|-------------|-----------|---------|-----------------------------|
| `sonarr` | `develop` | `false` | `sonarr-develop:3.0.8.1538` |
| `sonarr` | `develop` | `false` | `sonarr-develop:rolling` |
| `sonarr` | `main` | `true` | `sonarr:3.0.8.1507` |
| `sonarr` | `main` | `true` | `sonarr:rolling` |

## Deprecations

Expand Down
4 changes: 2 additions & 2 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ tasks:

test:
desc: |-
task APP=<app> CHANNEL=<channel> BASE=<true/false> test
task APP=<app> CHANNEL=<channel> test
cmds:
- task: download-goss
- >-
Expand All @@ -29,7 +29,7 @@ tasks:
{{end}}
-f ./apps/{{.APP}}/Dockerfile .
- >-
./.goss/dgoss run {{.APP}}:{{.CHANNEL}} {{if eq .BASE "true"}}tail -f /dev/null{{end}}
./.goss/dgoss run {{.APP}}:{{.CHANNEL}}
env:
CONTAINER_RUNTIME: docker
GOSS_PATH: ./.goss/goss
Expand Down
4 changes: 2 additions & 2 deletions apps/actions-runner/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ ENV HOMEBREW_NO_ANALYTICS=1 \
USER root

RUN \
apt-get update && apt-get upgrade -y \
apt-get update \
&& \
apt-get install -y --no-install-recommends \
apt-get install -y --no-install-recommends --no-install-suggests \
ca-certificates \
curl \
gcc \
Expand Down
3 changes: 1 addition & 2 deletions apps/actions-runner/metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
app: actions-runner
base: false
semantic_versioning: true
semver: true
channels:
- name: stable
platforms: ["linux/amd64"]
Expand Down
64 changes: 0 additions & 64 deletions apps/alpine/Dockerfile

This file was deleted.

24 changes: 0 additions & 24 deletions apps/alpine/ci/goss.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions apps/alpine/ci/latest.sh

This file was deleted.

10 changes: 0 additions & 10 deletions apps/alpine/metadata.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions apps/alpine/scripts/greeting.sh

This file was deleted.

28 changes: 0 additions & 28 deletions apps/alpine/scripts/sleep.sh

This file was deleted.

3 changes: 0 additions & 3 deletions apps/alpine/scripts/umask.sh

This file was deleted.

10 changes: 0 additions & 10 deletions apps/alpine/scripts/vpn.sh

This file was deleted.

50 changes: 34 additions & 16 deletions apps/bazarr/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/onedr0p/alpine:rolling@sha256:3fbc581cb0fe29830376161ae026e2a765dcc11e1747477fe9ebf155720b8638
FROM docker.io/library/alpine:3.19

ARG TARGETPLATFORM
ARG VERSION
Expand All @@ -13,34 +13,52 @@ ENV \
PIP_BREAK_SYSTEM_PACKAGES=1 \
CRYPTOGRAPHY_DONT_BUILD_RUST=1

RUN \
curl -fsSL -o /tmp/app.zip "https://github.com/morpheus65535/bazarr/releases/download/v${VERSION}/bazarr.zip" \
&& unzip -q /tmp/app.zip -d /app \
&& chown -R root:root /app \
&& chmod -R 755 /app \
&& rm -rf /tmp/*
USER root
WORKDIR /app

#hadolint ignore=DL3018,DL3013
RUN \
apk add --no-cache ca-certificates ffmpeg mediainfo python3 py3-lxml py3-numpy py3-gevent py3-cryptography py3-setuptools py3-psycopg2 py3-pillow unzip \
apk add --no-cache \
bash \
ca-certificates \
catatonit \
curl \
ffmpeg \
jq \
mediainfo \
nano \
py3-cryptography \
py3-gevent \
py3-lxml \
py3-numpy \
py3-pillow \
py3-psycopg2 \
py3-setuptools \
python3 \
tzdata \
unzip \
&& \
apk add --no-cache --virtual .build-deps py3-pip gcc python3-dev musl-dev \
apk add --no-cache --virtual .build-deps \
py3-pip \
gcc \
python3-dev \
musl-dev \
&& \
pip install --upgrade pip \
pip install --upgrade "webrtcvad-wheels>=2.0.10" \
&& \
pip install --upgrade \
"webrtcvad-wheels>=2.0.10" \
curl -fsSL -o /tmp/app.zip "https://github.com/morpheus65535/bazarr/releases/download/v${VERSION}/bazarr.zip" \
&& unzip -q /tmp/app.zip -d /app \
&& chown -R root:root /app \
&& chmod -R 755 /app \
&& apk del --purge .build-deps \
&& rm -rf \
/root/.cache \
/root/.cargo \
/tmp/*

# Install unrar
COPY --from=ghcr.io/linuxserver/unrar:7.0.7 /usr/bin/unrar-alpine /usr/bin/unrar

USER kah
COPY ./apps/bazarr/entrypoint.sh /entrypoint.sh
COPY --from=ghcr.io/linuxserver/unrar:7.0.7 /usr/bin/unrar-alpine /usr/bin/unrar
ENTRYPOINT ["/usr/bin/catatonit", "--"]
CMD ["/entrypoint.sh"]

LABEL org.opencontainers.image.source="https://github.com/morpheus65535/bazarr"
3 changes: 1 addition & 2 deletions apps/bazarr/metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
app: bazarr
base: false
semantic_versioning: true
semver: true
channels:
- name: stable
platforms: ["linux/amd64", "linux/arm64"]
Expand Down
Loading

0 comments on commit 364b303

Please sign in to comment.