Files
hackanooga.com/content/post/2024-03-07-self-hosted-package-registries-with-gitea.md
2025-02-19 16:36:29 -05:00

54 lines
2.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
author: mikeconrad
categories:
- Automation
- Docker
- OCI
- Self Hosted
dark_fusion_page_sidebar:
- sidebar-1
dark_fusion_site_layout:
- ""
date: "2024-03-07T10:07:07Z"
guid: https://wordpress.hackanooga.com/?p=413
id: 413
tags:
- Blog Post
title: Self hosted package registries with Gitea
url: /self-hosted-package-registries-with-gitea/
---
I am a big proponent of open source technologies. I have been using [Gitea](https://about.gitea.com/) for a couple years now in my homelab. A few years ago I moved most of my code off of Github and onto my self hosted instance. I recently came across a really handy feature that I didnt know Gitea had and was pleasantly surprised by: [Package Registry](https://docs.gitea.com/usage/packages/overview?_highlight=packag). You are no doubt familiar with what a package registry is in the broad context. Here are some examples of package registries you probably use on a regular basis:
- npm
- cargo
- docker
- composer
- nuget
- helm
There are a number of reasons why you would want to self host a registry. For example, in my home lab I have some `Docker` images that are specific to my use cases and I dont necessarily want them on a public registry. Im also not concerned about losing the artifacts as I can easily recreate them from code. Gitea makes this really easy to setup, in fact it comes baked in with the installation. For the sake of this post I will just assume that you already have Gitea installed and setup.
Since the package registry is baked in and enabled by default, I will demonstrate how easy it is to push a docker image. We will pull the default `alpine` image, re-tag it and push it to our internal registry:
```
# Pull the official Alpine image
docker pull alpine:latest
# Re tag the image with our local registry information
docker tag alpine:latest git.hackanooga.com/mikeconrad/alpine:latest
# Login using your gitea user account
docker login git.hackanooga.com
# Push the image to our registry
docker push git.hackanooga.com/mikeconrad/alpine:latest
```
Now log into your Gitea instance, navigate to your user account and look for `packages`. You should see the newly uploaded alpine image.
<figure class="wp-block-image size-large">![](https://wordpress.hackanooga.com/wp-content/uploads/2024/03/image-6-1024x313.png)</figure>You can see that the package type is container. Clicking on it will give you more information:
<figure class="wp-block-image size-large">![](https://wordpress.hackanooga.com/wp-content/uploads/2024/03/image-7-1024x437.png)</figure>