Add actions support for 4get docker image builds #66

Open
Fijxu wants to merge 1 commits from Fijxu/4get:4get-actions into master
Contributor

Supersedes #51

Supersedes #51
Fijxu added 1 commit 2025-02-02 04:30:59 +00:00
Owner

no fucking idea what a docker action is

@throwaway what do you make of this

no fucking idea what a docker action is @throwaway what do you make of this
Collaborator

gitea actions is gitea's implementation of github actions which makes it easy to react to changes on a repo such as a new push request,
https://docs.github.com/en/actions/about-github-actions/understanding-github-actions

each step is pulled from https://github.com/actions
for example: job "uses: actions/checkout@v4" will pull and run https://github.com/actions/checkout

with gitea actions you can pull actions from any host, but the default is github
https://docs.gitea.com/usage/actions/faq#where-will-the-runner-download-scripts-when-using-actions-such-as-actionscheckoutv4

you will need to have a runner, which is a program that will run the steps specified in the workflow
https://docs.gitea.com/runner/0.2.11/#run


I haven't used github/gitea actions personally, but I am a big fan of CI/CD. I personally think it's worth it to automate whenever you can. A few changes I'd make:

perhaps only run builds on master branch

on:
  workflow_dispatch:
  push:
    branches:
      - 'master'

So far we are just pushing to dockerhub so registry should be docker.io

    - name: Login to Docker Container Registry
      uses: docker/login-action@v3
      with:
        registry: docker.io
        username: ${{ secrets.USERNAME }}
        password: ${{ secrets.TOKEN }}

lolcat uses the username luuul
so images would be "luuul/4get" maybe "docker.io/luuul/4get" I am not sure

not sure if metadata action is needed
from https://github.com/docker/build-push-action
it seems you can just push to a tag


- name: Build and push
        uses: docker/build-push-action@v6
        with:
          push: true
          tags: luuul/4get:latest

@Fijxu thoughts?

gitea actions is gitea's implementation of github actions which makes it easy to react to changes on a repo such as a new push request, https://docs.github.com/en/actions/about-github-actions/understanding-github-actions each step is pulled from https://github.com/actions for example: job "uses: actions/checkout@v4" will pull and run https://github.com/actions/checkout with gitea actions you can pull actions from any host, but the default is github https://docs.gitea.com/usage/actions/faq#where-will-the-runner-download-scripts-when-using-actions-such-as-actionscheckoutv4 you will need to have a runner, which is a program that will run the steps specified in the workflow https://docs.gitea.com/runner/0.2.11/#run --- I haven't used github/gitea actions personally, but I am a big fan of CI/CD. I personally think it's worth it to automate whenever you can. A few changes I'd make: perhaps only run builds on master branch ``` on: workflow_dispatch: push: branches: - 'master' ``` So far we are just pushing to dockerhub so registry should be docker.io ``` - name: Login to Docker Container Registry uses: docker/login-action@v3 with: registry: docker.io username: ${{ secrets.USERNAME }} password: ${{ secrets.TOKEN }} ``` lolcat uses the username `luuul` so images would be "luuul/4get" maybe "docker.io/luuul/4get" I am not sure not sure if metadata action is needed from https://github.com/docker/build-push-action it seems you can just push to a tag ``` - name: Build and push uses: docker/build-push-action@v6 with: push: true tags: luuul/4get:latest ``` @Fijxu thoughts?
Author
Contributor

perhaps only run builds on master branch

I'll change that, oppsie :3!

So far we are just pushing to dockerhub so registry should be docker.io

That's ok. I don't like DockerHub since it's a closed source image registry. It's better to upload the images to the own image registry that Gitea has, but if the git server goes down for some reason, the image will not be available to download.
Quay.io is a good FOSS alternative

That's up to @lolcat, but the action can be modified to upload to two image registries instead of just using one and let the user to decide which registry to use.

not sure if metadata action is needed

It's needed to catalog old and new images generated. Each new image will contain a latest tag and a YYYY.MM.DD-commit_hash on it. When a new commit is pushed, the latest image will be replaced by the latest commit, meanwhile the one with the tag YYYY.MM.DD-commit_hash will be preserved on the registry.

(Ex: https://git.nadeko.net/Fijxu/-/packages/container/invidious/versions)

>perhaps only run builds on master branch I'll change that, oppsie :3! >So far we are just pushing to dockerhub so registry should be docker.io That's ok. I don't like DockerHub since it's a closed source image registry. It's better to upload the images to the own image registry that Gitea has, but if the git server goes down for some reason, the image will not be available to download. [Quay.io](https://github.com/quay/quay) is a good FOSS alternative That's up to @lolcat, but the action can be modified to upload to two image registries instead of just using one and let the user to decide which registry to use. >not sure if metadata action is needed It's needed to catalog old and new images generated. Each new image will contain a `latest` tag and a `YYYY.MM.DD-commit_hash` on it. When a new commit is pushed, the `latest` image will be replaced by the latest commit, meanwhile the one with the tag `YYYY.MM.DD-commit_hash` will be preserved on the registry. (Ex: https://git.nadeko.net/Fijxu/-/packages/container/invidious/versions)
Fijxu added 1 commit 2025-02-04 21:42:51 +00:00
Fijxu force-pushed 4get-actions from 479854d9d7 to 13dfa9240c 2025-02-04 21:47:33 +00:00 Compare
Fijxu added 1 commit 2025-02-04 21:50:15 +00:00
Collaborator

It's needed to catalog old and new images generated

Oh okay

but the action can be modified to upload to two image registries instead of just using one and let the user to decide which registry to use.

perhaps reference registry in a secret?

>It's needed to catalog old and new images generated Oh okay >but the action can be modified to upload to two image registries instead of just using one and let the user to decide which registry to use. perhaps reference registry in a secret?
Author
Contributor

perhaps reference registry in a secret?

No, just duplicate this line

    - name: Login to Docker Container Registry (git.lolcat.ca)
      uses: docker/login-action@v3
      with:
        registry: git.lolcat.ca
        username: ${{ secrets.GITEA_USERNAME }}
        password: ${{ secrets.GITEA_TOKEN }}

    - name: Login to Docker Container Registry (quay.io)
      uses: docker/login-action@v3
      with:
        registry: quay.io
        username: ${{ secrets.QUAY_USERNAME }}
        password: ${{ secrets.QUAY_TOKEN }}

and so on with the other steps. That should work fine, but I haven't tried that. I'll wait for @lolcat and see what he says about it before trying it.

> perhaps reference registry in a secret? No, just duplicate this line ``` - name: Login to Docker Container Registry (git.lolcat.ca) uses: docker/login-action@v3 with: registry: git.lolcat.ca username: ${{ secrets.GITEA_USERNAME }} password: ${{ secrets.GITEA_TOKEN }} - name: Login to Docker Container Registry (quay.io) uses: docker/login-action@v3 with: registry: quay.io username: ${{ secrets.QUAY_USERNAME }} password: ${{ secrets.QUAY_TOKEN }} ``` and so on with the other steps. That should work fine, but I haven't tried that. I'll wait for @lolcat and see what he says about it before trying it.
Owner

I'm failing to understand what purpose this has. I never used github actions or what git checkout does.

From what I'm reading here, it sounds like this generates a new docker image every time I push code? What compiles that code exactly, the gitea server?

I'm failing to understand what purpose this has. I never used github actions or what `git checkout` does. From what I'm reading here, it sounds like this generates a new docker image every time I push code? What compiles that code exactly, the gitea server?
First-time contributor

What compiles that code exactly, the gitea server?

I believe you need to install an agent on the server you want to use to compile the code. You can do it on the same server where Gitea is.

...never used github actions or what git checkout does.

I don't think we need to use GitHub Actions, although GitHub's servers are free to use, but you can use your own server instead with Gitea Actions. git checkout is used to simply switch between branches in the command line.

> What compiles that code exactly, the gitea server? I believe you need to install an agent on the server you want to use to compile the code. You can do it on the same server where Gitea is. > ...never used github actions or what git checkout does. I don't think we need to use GitHub Actions, although GitHub's servers are free to use, but you can use your own server instead with Gitea Actions. `git checkout` is used to simply switch between branches in the command line.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
You can also view command line instructions.

Step 1:

From your project repository, check out a new branch and test the changes.
git checkout -b Fijxu-4get-actions master
git pull 4get-actions

Step 2:

Merge the changes and update on Gitea.
git checkout master
git merge --no-ff Fijxu-4get-actions
git push origin master
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: lolcat/4get#66
No description provided.