template for oci image project
Find a file Use this template
Thibaut Chavanon e27cf69f1f refactor(Container): ♻️ - changing ENTRRYPOINT and CMD command
Since i specify unporivilegred user with the USER directive, using an wrapper script as entrypoint to lower privileged is pointless
2026-01-26 15:54:16 +00:00
.chglog feat(changelog): - add support for git-chglog 2026-01-09 14:44:42 +00:00
.devcontainer feat(devcontainer): - add devcontainer support 2026-01-07 21:36:04 +00:00
.forgejo feat(workflows): - add support for forgejo workflows 2026-01-09 14:43:38 +00:00
.mise-tasks refactor(tests): ♻️ - refector test and mise task 'test' 2026-01-26 15:05:03 +00:00
.vscode chore(vscode-settings): 🔧 - add "trivy" scope 2026-01-26 15:06:44 +00:00
.editorconfig feat(code formatter): - add support for Editorconfig and prettier 2026-01-07 21:25:05 +00:00
.gitignore feat(gitignore): - add support for gitignore 2026-01-07 21:37:50 +00:00
.hadolint.yaml feat(linter): - add support for default hadolint configuration 2026-01-12 15:52:27 +00:00
.prettierrc.yaml feat(code formatter): - add support for Editorconfig and prettier 2026-01-07 21:25:05 +00:00
Dockerfile refactor(Container): ♻️ - changing ENTRRYPOINT and CMD command 2026-01-26 15:54:16 +00:00
entrypoint.sh feat(Container): - add support for Dockerfile + entrypoint.sh 2026-01-09 15:35:09 +00:00
mise.toml feat(mise): - add support for mise config 2026-01-07 20:27:11 +00:00
privileged-test.yml refactor(tests): ♻️ - refector test and mise task 'test' 2026-01-26 15:05:03 +00:00
README.md docs(readme): 📝 - update README.md 2026-01-09 15:00:02 +00:00
trivy.yaml feat(trivy): - add support for trivy configuration 2026-01-26 15:06:01 +00:00
unprivileges-tests.yml refactor(tests): ♻️ - refector test and mise task 'test' 2026-01-26 15:05:03 +00:00

oci-tpl

Template for your oci projects with battery included !

Quickstart

to get started with this template, git clone this repo and push to a new origin. you can copy/paste the code below to do so :

printf "enter your repo url\n" \
  && read REPO_URL \
  && printf "enter your project name\n" \
  && read PROJECT_NAME \
  && git clone https://git.hvn.wf/repo-template/oci-tpl.git \
  && git -C bash-tpl remote set-url origin "${REPO_URL}" \
  && mv oci-tpl "${PROJECT_NAME}"

To get the most of the this template, i reccommend to set up a devcontainer environnement for VScode. You can do this easily with Devpod (https://devpod.sh/). you can copy/paste below for a local configuration using podman as container engine. It will also create two shared directory on your home for container-storage and libpod, needed by the devcontaienr (see devcontainer.json) for more detail. Ensure that devpod-cli is installed and in your path before running this :

printf "enter local path to your git repo\n" \
&& read REPO_LOCAl_PATH \
&& mkdir -p "${HOME}"/.devcontainer-volumes/{container-storage,libpod} \
&& devpod provider add docker -o DOCKER_PATH=podman \
&& devpod up "${REPO_LOCAl_PATH]" --ide vscode

voila ! everything is set, you just have to run mise install in vscode terminal to install dev-tools in mise config.

Vscode extension will be automatically installed, check them out in the extension tab, or in the devcontainer.json.

How to

Dev-workflow

I try to follow the least privilege principle when i am devlopping oci image ( https://en.wikipedia.org/wiki/Principle_of_least_privilege ). I run my container using Podman (https://podman.io/) or Kubernetes (https://kubernetes.io/). This could have a influence on my designs. My container are rootless by default (https://rootlesscontaine.rs/)

Env variables/secret

Env variable can be defined in mise.toml, or in the forge if you just need those variable in ci. Secrets are kept on the forge.

Automated tasks

to simplify usual task ( run tst, artifact building, setup thing) i am using mise tasks in dedicated file in .mise-tasks. There is 5 tasks by default :

  • test : run test. You must specify the type of test. Available args are unit_tests,security_scan or all. Artifact must be build prior to testing.
  • build: build artifact. You must specify artifact tag.
  • push: push artifact on oci repo. You must specify artifact tag.
  • patch: patch artifact with copacetic.
  • symlink-prettier-plugin: symlink /root/.local/share/mise/installs/< plugin_name >/latest/lib/node_modules to ./node_module, so prettier plugin installed via mise could be usable in project directory

To run a task, type mise run <task_name> <args> <option/flag>

CI/CD

CI/CD pipelines are using forgejo action system (https://forgejo.org/docs/next/user/actions/overview/). The syntax is mostly similar to github action, so github action docs should apply in most case (https://github.com/features/actions). Maybe i will do a template for gitlab one day, stay tuned.

Linting/code formating

I use shellcheck and Hadolint to lint bash and Dockerfile code. feel free to check .shelcheckrc and .hadolintlintrc.yaml , if i ever add a linter exception, there should be a comment explaining why.

To ensure my code is properly formated, i use Editorconfig (https://editorconfig.org/) and prettier (https://prettier.io/) with bash and toml plugin. Feel free to check .editorconfig and .prettierrc.yaml to see what i've defined.

I will add a step to format everything in my ci late, for now its just a check, i format things locally.

additional notes

this project is following the semantic versioning guidline (https://semver.org/),as well as Angular conventional commits (https://www.conventionalcommits.org/en/v1.0.0-beta.4/). Gitmojis are here for fun (https://gitmoji.dev/).

I am trying to stick to known best practice to the best of my abilities.

Watch out for new version of this repo, i am always learning !

here some external documentation for all the tool used in this template: