alex3025 / ilo-fans-controller

Easily manage your HP server's fans speeds, anywhere!
MIT License
159 stars 12 forks source link

Add Docker Build and Push Workflow to GHCR #11

Closed NAKNAO-nnct closed 6 months ago

NAKNAO-nnct commented 8 months ago

This PR is a new GitHub Actions workflow that builds and pushes Docker images to the GitHub Container Registry (GHCR).

This workflow is triggered by a push event to the main branch or a tag starting with v. It can also be triggered manually on a given tag.

Docker images will be tagged with the Git tag, if present, and if the Git tag starts with v, the image will also be tagged with latest.

Users can docker pull to launch without doing a docker build themselves.

Sample Packages → https://github.com/NAKNAO-nnct/ilo-fans-controller/pkgs/container/ilo-fans-controller

translated by DeepL

Arszilla commented 7 months ago

This would be great, as it would allow the use of image: alex3025/ilo-fan-controller:latest, instead of how it is now.

alex3025 commented 6 months ago

I don't know much about GH Actions, is it plug&play or I need to manually set some variables/secrets in the repo settings?

NAKNAO-nnct commented 6 months ago

@alex3025

Thank you for your question! The GitHub Actions part is plug-and-play configurable; the necessary actions are already defined in the workflow file, including the action to push the image to the GitHub Container Registry (GHCR).

After merging into the main branch, the workflow will automatically build and push the images to the GitHub Container Registry. You will then need to manually Publish the image from packages on GitHub. For more information, see Configuring visibility of packages for your personal account for more information.

If you have further questions or need assistance with any part of the setup, please let us know.

translated by DeepL

alex3025 commented 6 months ago

It would be great to update the README including the Docker command to show how to run the image.

@NAKNAO-nnct can you help me with this? (I need just the full docker run command and I'll take care of the rest)

NAKNAO-nnct commented 6 months ago

@alex3025 OK, Just a moment, please.

NAKNAO-nnct commented 6 months ago

@alex3025 I think you can start it with the following command. However, “ghcr.io/alex3025/ilo-fans-controller:latest” is not yet merged, so an error occurs. If you want to try locally, change to “ghcr.io/naknao-nnct/ilo-fans-controller:latest” and try again.

translated by DeepL

use docker command

docker run -d --name ilo-fans-controller --restart always -p 8000:80 -e ILO_HOST='your-ilo-address' -e ILO_USERNAME='your-ilo-username' -e ILO_PASSWORD='your-ilo-password' ghcr.io/alex3025/ilo-fan-controller:latest

use compose.yaml

services:
  ilo-fans-controller:
    image: ghcr.io/alex3025/ilo-fan-controller:latest
    restart: always
    ports:
      - "8000:80"
    environment:
      ILO_HOST: 'your-ilo-address'
      ILO_USERNAME: 'your-ilo-username'
      ILO_PASSWORD: 'your-ilo-password'

or use .env file

.env

ILO_HOST="your-ilo-address"
ILO_USERNAME="your-ilo-username"
ILO_PASSWORD="your-ilo-password"

compose.yaml

services:
  ilo-fans-controller:
    image: ghcr.io/alex3025/ilo-fan-controller:latest
    restart: always
    ports:
      - "8000:80"
    env_file:
      - .env
alex3025 commented 6 months ago

Now's everything good. Merging, thank you :)

NAKNAO-nnct commented 6 months ago

thanks you!

alex3025 commented 3 months ago

It would be great to leave only the latest release container available, deleting all the others every workflow run.

@NAKNAO-nnct is it possible?

NAKNAO-nnct commented 1 month ago

@alex3025

Sorry about that. I just noticed the issue. It should be possible. I'll try it out and let you know if it looks okay.