Publish Docker image to Gitea registry
Docker Build / Build Docker image (push) Failing after 8s

This commit is contained in:
unknown
2026-06-10 12:35:59 +09:00
parent 1811e351aa
commit 67864994aa
4 changed files with 78 additions and 16 deletions
+27 -4
View File
@@ -2,11 +2,18 @@ name: Docker Build
on: on:
push: push:
branches:
- main
pull_request: pull_request:
workflow_dispatch: workflow_dispatch:
permissions:
contents: read
packages: write
env: env:
IMAGE_NAME: idrac-info REGISTRY: gitea.mouse84.com
IMAGE_NAME: kim.kanghee/idrac-info
DOCKERFILE: Dockerfile DOCKERFILE: Dockerfile
BUILD_CONTEXT: . BUILD_CONTEXT: .
@@ -23,7 +30,10 @@ jobs:
shell: bash shell: bash
run: | run: |
SHORT_SHA="$(printf '%s' "${GITHUB_SHA:-local}" | cut -c1-12)" SHORT_SHA="$(printf '%s' "${GITHUB_SHA:-local}" | cut -c1-12)"
echo "IMAGE_TAG=${IMAGE_NAME}:${SHORT_SHA}" >> "${GITHUB_ENV}" IMAGE_REPO="${REGISTRY}/${IMAGE_NAME}"
echo "IMAGE_REPO=${IMAGE_REPO}" >> "${GITHUB_ENV}"
echo "IMAGE_TAG=${IMAGE_REPO}:${SHORT_SHA}" >> "${GITHUB_ENV}"
echo "IMAGE_LATEST=${IMAGE_REPO}:latest" >> "${GITHUB_ENV}"
echo "SHORT_SHA=${SHORT_SHA}" >> "${GITHUB_ENV}" echo "SHORT_SHA=${SHORT_SHA}" >> "${GITHUB_ENV}"
- name: Show Docker version - name: Show Docker version
@@ -43,10 +53,23 @@ jobs:
--pull \ --pull \
--file "${DOCKERFILE}" \ --file "${DOCKERFILE}" \
--tag "${IMAGE_TAG}" \ --tag "${IMAGE_TAG}" \
--tag "${IMAGE_NAME}:ci" \ --tag "${IMAGE_LATEST}" \
"${BUILD_CONTEXT}" "${BUILD_CONTEXT}"
- name: Inspect built image - name: Inspect built image
run: | run: |
docker image inspect "${IMAGE_TAG}" > /dev/null docker image inspect "${IMAGE_TAG}" > /dev/null
docker images "${IMAGE_NAME}" docker images "${IMAGE_REPO}"
- name: Login to Gitea Container Registry
if: gitea.event_name == 'push' && gitea.ref == 'refs/heads/main'
run: |
echo "${{ secrets.GITEA_TOKEN }}" | docker login "${REGISTRY}" \
--username "${{ gitea.actor }}" \
--password-stdin
- name: Push Docker image
if: gitea.event_name == 'push' && gitea.ref == 'refs/heads/main'
run: |
docker push "${IMAGE_TAG}"
docker push "${IMAGE_LATEST}"
+44 -8
View File
@@ -1,18 +1,39 @@
# Docker Usage # Docker Usage
Build and run the app with Docker Compose: The default compose file pulls the image from the Gitea Container Registry:
```powershell ```powershell
docker compose up --build docker compose pull
docker compose up -d
```
Default image:
```text
gitea.mouse84.com/kim.kanghee/idrac-info:latest
```
Use a specific image tag:
```powershell
$env:IDRAC_INFO_IMAGE = "gitea.mouse84.com/kim.kanghee/idrac-info:<commit-sha>"
docker compose pull
docker compose up -d
```
Build locally instead of pulling:
```powershell
docker compose -f docker-compose.yml -f docker-compose.build.yml up --build -d
``` ```
Build only: Build only:
```powershell ```powershell
docker build -t idrac-info:local . docker build -t gitea.mouse84.com/kim.kanghee/idrac-info:local .
``` ```
Run the built image without Compose: Run the pulled image without Compose:
```powershell ```powershell
docker run --rm --network host ` docker run --rm --network host `
@@ -21,7 +42,7 @@ docker run --rm --network host `
-e AUTO_BOOTSTRAP_DB=true ` -e AUTO_BOOTSTRAP_DB=true `
-v ${PWD}/data:/app/data ` -v ${PWD}/data:/app/data `
-v ${PWD}/backend/instance:/app/backend/instance ` -v ${PWD}/backend/instance:/app/backend/instance `
idrac-info:local gitea.mouse84.com/kim.kanghee/idrac-info:latest
``` ```
Open the app: Open the app:
@@ -42,7 +63,7 @@ process already uses `6050` on the host.
Run in the background: Run in the background:
```powershell ```powershell
docker compose up --build -d docker compose up -d
``` ```
Stop the container: Stop the container:
@@ -75,7 +96,7 @@ The container defaults to port `6050`. To use a different host port:
```powershell ```powershell
$env:FLASK_PORT = "8080" $env:FLASK_PORT = "8080"
docker compose up --build docker compose up -d
``` ```
Then open: Then open:
@@ -117,7 +138,22 @@ call `racadm` directly.
After building, verify the tools inside the image: After building, verify the tools inside the image:
```powershell ```powershell
docker run --rm idrac-info:local sh -lc "command -v racadm && command -v ipmitool && ipmitool -V" docker run --rm gitea.mouse84.com/kim.kanghee/idrac-info:latest sh -lc "command -v racadm && command -v ipmitool && ipmitool -V"
```
## Registry
Gitea Actions builds and pushes these tags on `main`:
```text
gitea.mouse84.com/kim.kanghee/idrac-info:latest
gitea.mouse84.com/kim.kanghee/idrac-info:<short-sha>
```
If the package is private, log in before pulling:
```powershell
docker login gitea.mouse84.com
``` ```
Host networking works as expected on Linux Docker hosts. Docker Desktop on Host networking works as expected on Linux Docker hosts. Docker Desktop on
+6
View File
@@ -0,0 +1,6 @@
services:
idrac-info:
build:
context: .
dockerfile: Dockerfile
image: "${IDRAC_INFO_IMAGE:-gitea.mouse84.com/kim.kanghee/idrac-info:local}"
+1 -4
View File
@@ -1,9 +1,6 @@
services: services:
idrac-info: idrac-info:
build: image: "${IDRAC_INFO_IMAGE:-gitea.mouse84.com/kim.kanghee/idrac-info:latest}"
context: .
dockerfile: Dockerfile
image: idrac-info:local
container_name: idrac-info container_name: idrac-info
network_mode: "host" network_mode: "host"
environment: environment: