Author SHA1 Message Date
thuanleandClaude 155991fcbc feat(node-go): add golangci-lint + Renovate auto-bump
node-go image / build (amd64) (push) Failing after 1s
node-go image / build (arm64) (push) Failing after 53s
node-go image / amend-manifest (push) Skipped
- Add golangci-lint v2.12.2 to node-go image (arch-aware via official install.sh)
- Wire renovate.json to auto-bump GOLANGCI_LINT_VERSION (minor/patch automerge)
  and GO_VERSION (patch automerge); keep pins for reproducible/rollback-able builds
- Add node-go/README.md documenting installed tools and what's NOT included
- Update root README accordingly

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-11 15:20:24 +07:00
thuanle 1e0f44962f Update .gitea/workflows/docker-node.yml 2026-08-02 11:38:49 +07:00
codex 9edcc1e9c9 docker armv7
docker-node image / build (armv7) (push) Failing after 2s
docker-node image / build (arm64) (push) Successful in 13s
docker-node image / build (amd64) (push) Successful in 45s
docker-node image / amend-manifest (push) Skipped
2026-07-28 20:06:42 +07:00
codex b543857595 docker armv7 2026-07-28 20:03:37 +07:00
thuanle 32f2065446 feat: update workflows and Dockerfiles for node-go, node-python, and docker-node images
docker-node image / build (arm64) (push) Successful in 15s
node-go image / build (arm64) (push) Successful in 16s
node-go image / build (amd64) (push) Successful in 7s
docker-node image / build (amd64) (push) Successful in 48s
node-python image / build (amd64) (push) Successful in 8s
docker-node image / amend-manifest (push) Successful in 5s
node-python image / build (arm64) (push) Successful in 15s
node-go image / amend-manifest (push) Successful in 15s
node-python image / amend-manifest (push) Successful in 14s
2026-06-23 16:49:10 +07:00
thuanle bb01daeb4d add gcc for go
docker-node image / build (amd64) (push) Successful in 9s
docker-node image / build (arm64) (push) Successful in 30s
docker-node image / amend-manifest (push) Successful in 19s
node-go image / build (amd64) (push) Successful in 1m14s
node-python image / build (amd64) (push) Failing after 1m17s
node-go image / build (arm64) (push) Successful in 1m46s
node-go image / amend-manifest (push) Successful in 9s
node-python image / build (arm64) (push) Successful in 32s
node-python image / amend-manifest (push) Has been skipped
2026-06-23 16:33:44 +07:00
thuanle 69591ec230 ci
docker-node image / build (arm64) (push) Successful in 5s
docker-node image / build (amd64) (push) Successful in 11s
node-python image / build (arm64) (push) Successful in 16s
docker-node image / amend-manifest (push) Successful in 14s
node-python image / build (amd64) (push) Successful in 21s
node-go image / build (arm64) (push) Successful in 43s
node-python image / amend-manifest (push) Successful in 4s
node-go image / build (amd64) (push) Successful in 1m16s
node-go image / amend-manifest (push) Successful in 14s
2026-04-28 00:11:02 +07:00
11 changed files with 203 additions and 140 deletions
+4 -2
View File
@@ -2,6 +2,8 @@ name: docker-node image
on:
push:
paths:
- docker-node/**
schedule:
- cron: '0 0 * * 0' # 00:00 sáng Chủ nhật (UTC)
workflow_dispatch: # Cho phép chạy tay nếu cần
@@ -34,11 +36,11 @@ jobs:
echo "Building image ${{ env.IMAGE }} for architecture: ${{ matrix.arch }}"
docker build \
-f ${{ env.IMAGE }}.Dockerfile \
-f ${{ env.IMAGE }}/Dockerfile \
-t ${{ env.IMAGE_BASE }}:${{ env.IMAGE }}-${{ matrix.arch }}-latest \
--label "build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \
--label "commit_sha=${{ github.sha }}" \
.
${{ env.IMAGE }}
docker push ${{ env.IMAGE_BASE }}:${{ env.IMAGE }}-${{ matrix.arch }}-latest
+68
View File
@@ -0,0 +1,68 @@
name: node-go image
on:
push:
paths:
- node-go/**
schedule:
- cron: '0 2 * * 0' # 02:00 sáng Chủ nhật (UTC)
workflow_dispatch:
env:
IMAGE_REPO: git.thuanle.me/public/node-go
IMAGE: node-go
jobs:
build:
strategy:
matrix:
arch:
- arm64
- amd64
runs-on: ${{ matrix.arch }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to Docker Registry
uses: docker/login-action@v3
with:
registry: git.thuanle.me
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Docker images
run: |
echo "Building image ${{ env.IMAGE }} for architecture: ${{ matrix.arch }}"
docker build \
-f ${{ env.IMAGE }}/Dockerfile \
-t ${{ env.IMAGE_REPO }}:${{ matrix.arch }}-latest \
--label "build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \
--label "commit_sha=${{ github.sha }}" \
${{ env.IMAGE }}
docker push ${{ env.IMAGE_REPO }}:${{ matrix.arch }}-latest
amend-manifest:
runs-on: linux
needs: [build]
steps:
- name: Login to Docker Registry
uses: docker/login-action@v3
with:
registry: git.thuanle.me
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push Docker manifest
run: |
echo "Delete existing manifest"
docker manifest rm ${{ env.IMAGE_REPO }}:latest || true
echo "Create new manifest"
docker manifest create ${{ env.IMAGE_REPO }}:latest \
${{ env.IMAGE_REPO }}:amd64-latest \
${{ env.IMAGE_REPO }}:arm64-latest
docker manifest push ${{ env.IMAGE_REPO }}:latest
+4 -2
View File
@@ -2,6 +2,8 @@ name: node-python image
on:
push:
paths:
- node-python/**
schedule:
- cron: '0 1 * * 0' # 01:00 sáng Chủ nhật (UTC)
workflow_dispatch: # Cho phép chạy tay nếu cần
@@ -34,11 +36,11 @@ jobs:
echo "Building image ${{ env.IMAGE }} for architecture: ${{ matrix.arch }}"
docker build \
-f ${{ env.IMAGE }}.Dockerfile \
-f ${{ env.IMAGE }}/Dockerfile \
-t ${{ env.IMAGE_BASE }}:${{ env.IMAGE }}-${{ matrix.arch }}-latest \
--label "build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \
--label "commit_sha=${{ github.sha }}" \
.
${{ env.IMAGE }}
docker push ${{ env.IMAGE_BASE }}:${{ env.IMAGE }}-${{ matrix.arch }}-latest
+7 -5
View File
@@ -6,7 +6,7 @@ Kho lưu trữ này cung cấp các Docker base image cho nhiều mục đích s
- **docker-node**
- `git.thuanle.me/public/base:docker-node-latest`
- Dockerfile: [docker-node.Dockerfile](docker-node.Dockerfile)
- Dockerfile: [docker-node/Dockerfile](docker-node/Dockerfile)
- Các gói/phần mềm đã cài đặt:
- **Node.js v22** kèm theo **npm****yarn**
- **Docker CLI**
@@ -14,21 +14,23 @@ Kho lưu trữ này cung cấp các Docker base image cho nhiều mục đích s
- **node-python**
- `git.thuanle.me/public/base:node-python-latest`
- Dockerfile: [node-python.Dockerfile](node-python.Dockerfile)
- Dockerfile: [node-python/Dockerfile](node-python/Dockerfile)
- Các gói/phần mềm đã cài đặt:
- **Node.js** kèm theo **npm****yarn**
- **git**
- **python v3.11**
- **node-go**
- `git.thuanle.me/public/base:node-go-latest`
- Dockerfile: [node-go.Dockerfile](node-go.Dockerfile)
- `git.thuanle.me/public/node-go:latest`
- Dockerfile: [node-go/Dockerfile](node-go/Dockerfile)
- Workflow: [.gitea/workflows/node-go.yml](.gitea/workflows/node-go.yml)
- Các gói/phần mềm đã cài đặt:
- **Node.js** kèm theo **npm****yarn**
- **git**
- **Go 1.26**
- **golangci-lint v2.12.2**
- Ghi chú:
- `GO_VERSION` hiện được giữ ở mức `1.26` và sẽ nâng thủ công khi cần
- Phiên bản (`GO_VERSION`, `GOLANGCI_LINT_VERSION`) được pin trong Dockerfile; [Renovate](renovate.json) tự bump qua PR khi có release mới (auto-merge minor/patch)
## Update
View File
@@ -1,125 +0,0 @@
# Node + Go Base Image Design
## Context
Repository này đang duy trì các Docker base image nhỏ, tập trung cho từng nhu cầu riêng:
- `docker-node.Dockerfile`: Node.js + Docker CLI + git
- `node-python.Dockerfile`: Node.js + Python + git
Mục tiêu của thay đổi này là bổ sung thêm một base image mới cho nhu cầu chạy dự án có cả Node.js và Go, đồng thời giữ cấu trúc và phong cách nhất quán với các image hiện có.
## Goals
- Thêm một Dockerfile mới cho image `node-go`
- Giữ base image đồng nhất với repo: `node:lts-slim`
- Cài Go từ tarball chính thức thay vì `apt`
- Giữ `GO_VERSION` ở mức dễ đọc theo nhánh chính như `1.26`
- Giữ image tối giản, chỉ cài thêm các gói hệ thống thật sự cần thiết
- Cập nhật `README.md` để công bố image mới và các thành phần đi kèm
## Non-Goals
- Không thêm Docker CLI
- Không thêm Python
- Không pin cứng Node sang một major riêng ngoài `node:lts-slim`
- Không thêm bộ công cụ build phụ ngoài những gì cần để tải và giải nén Go
## Options Considered
### Option 1: Cài Go từ Debian `apt`
Ưu điểm:
- Dockerfile ngắn hơn
- Ít logic cài đặt hơn
Nhược điểm:
- Version Go thường chậm hơn bản phát hành chính thức
- Khó dùng làm base image chung cho CI hoặc project cần Go mới hơn
### Option 2: Cài Go từ tarball chính thức
Ưu điểm:
- Kiểm soát nhánh version Go rõ ràng bằng biến môi trường
- Cập nhật nhanh hơn so với `apt`
- Phù hợp hơn cho image nền dùng lại nhiều nơi
Nhược điểm:
- Dockerfile dài hơn một chút
- Cần xử lý mapping kiến trúc để chọn đúng tarball
## Chosen Design
Chọn Option 2.
Image mới sẽ:
- dùng `FROM node:lts-slim`
- cài `ca-certificates`, `curl`, `git`
- khai báo `GO_VERSION`
- xác định kiến trúc hiện tại từ `dpkg --print-architecture`
- nếu `GO_VERSION``major.minor`, tải bản `.0` tương ứng trong nhánh đó
- tải Go tarball phù hợp từ `https://go.dev/dl/`
- giải nén vào `/usr/local/go`
- thêm `/usr/local/go/bin` vào `PATH`
- giữ `WORKDIR /app`
## Implementation Details
### Dockerfile mới
Tạo file `node-go.Dockerfile` với cấu trúc gần giống các Dockerfile hiện có trong repo:
1. `FROM node:lts-slim`
2. Khai báo `ENV DEBIAN_FRONTEND=noninteractive`
3. Cài các package hệ thống tối thiểu:
- `ca-certificates`
- `curl`
- `git`
4. Khai báo `ARG GO_VERSION`
5. Dùng `dpkg --print-architecture` để map:
- `amd64` -> `linux-amd64`
- `arm64` -> `linux-arm64`
6. Nếu `GO_VERSION``major.minor`, map sang `.0` để tạo version tải cụ thể
7. Tải tarball Go tương ứng, giải nén vào `/usr/local`
8. Xóa file tạm và cache `apt`
9. Khai báo `PATH=/usr/local/go/bin:${PATH}`
10. Giữ `WORKDIR /app`
### README
`README.md` sẽ được cập nhật để thêm mục `node-go`, gồm:
- image tag dự kiến theo naming convention hiện có
- đường dẫn Dockerfile
- danh sách phần mềm chính:
- Node.js kèm npm và yarn
- Go
- git
## Verification Plan
Sau khi implement:
- kiểm tra cú pháp và nội dung Dockerfile mới
- build thử image bằng `docker build -f node-go.Dockerfile .` nếu môi trường cho phép
- xác nhận các binary chính tồn tại:
- `node --version`
- `go version`
- `git --version`
## Risks
- URL tải Go hoặc naming của tarball có thể đổi nếu `GO_VERSION` không hợp lệ
- Mapping kiến trúc cần xử lý rõ để tránh build fail trên `arm64`
- Nếu cần patch mới hơn trong cùng nhánh, phải nâng thủ công trong Dockerfile
## Open Decisions Resolved
- Chọn cài Go từ tarball chính thức thay vì `apt`
- Giữ `node:lts-slim` để đồng nhất với repo hiện tại
- Giữ image tối giản, không gộp thêm Docker CLI hoặc Python
+6 -1
View File
@@ -1,13 +1,14 @@
FROM node:lts-slim
ARG GO_VERSION=1.26
ARG GOLANGCI_LINT_VERSION=v2.12.2
ENV DEBIAN_FRONTEND=noninteractive \
PATH=/usr/local/go/bin:${PATH}
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends ca-certificates curl git; \
apt-get install -y --no-install-recommends ca-certificates curl git gcc libc6-dev; \
arch="$(dpkg --print-architecture)"; \
case "${arch}" in \
amd64) go_arch='linux-amd64' ;; \
@@ -23,6 +24,10 @@ RUN set -eux; \
rm -rf /usr/local/go; \
tar -C /usr/local -xzf /tmp/go.tgz; \
rm -f /tmp/go.tgz; \
curl -fsSL -o /tmp/golangci-lint-install.sh \
"https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh"; \
sh /tmp/golangci-lint-install.sh -b /usr/local/bin "${GOLANGCI_LINT_VERSION}"; \
rm -f /tmp/golangci-lint-install.sh; \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
+76
View File
@@ -0,0 +1,76 @@
# node-go
Docker base image gồm **Node.js** + **Go** + công cụ lint, dùng làm môi trường
build/test cho CI.
- Image: `git.thuanle.me/public/node-go:latest`
- Dockerfile: [Dockerfile](Dockerfile)
- Workflow: [`.gitea/workflows/node-go.yml`](../.gitea/workflows/node-go.yml)
## Kiến trúc được hỗ trợ
- `linux/amd64`
- `linux/arm64`
Image được build song song cho cả hai kiến trúc rồi gộp vào một multi-arch
manifest, kéo bằng `:latest` sẽ tự nhận đúng kiến trúc của host.
## Đã cài đặt sẵn
| Phần mềm | Phiên bản | Ghi chú |
|---|---|---|
| Node.js | LTS (cùng phiên bản với `node:lts-slim`) | kèm **npm****yarn** |
| Go | `1.26` | cài nhị phân chính thức từ `go.dev`, đặt tại `/usr/local/go` |
| golangci-lint | `v2.12.2` | cài vào `/usr/local/bin`, dùng cho `go lint`/CI |
| git | (apt) | |
| gcc + libc6-dev | (apt) | cần cho **cgo** và một số package Go build bằng C |
| ca-certificates, curl | (apt) | |
> Các phiên bản Go/golangci-lint được **pin bằng `ARG`** trong Dockerfile
> (`GO_VERSION`, `GOLANGCI_LINT_VERSION`) để build ổn định & rollback được, đồng
> thời **[Renovate](../renovate.json) tự bump** qua PR khi có release mới:
> - golangci-lint: auto-merge **minor/patch** (major vd v2→v3 mở PR review).
> - Go: auto-merge **patch**; minor (vd 1.26→1.27) mở PR review.
## Cách sử dụng
```yaml
# .gitea/workflows/...
container:
image: git.thuanle.me/public/node-go:latest
steps:
- run: node -v && go version && golangci-lint version
- run: golangci-lint run ./...
- run: go test ./...
```
Hoặc chạy cục bộ:
```bash
docker run --rm git.thuanle.me/public/node-go:latest \
sh -c "go version && golangci-lint version"
```
## Những gì KHÔNG có (có thể cần cài thêm)
Image này cố gắng nhỏ gọn, nên một số thứ sau **không** được cài sẵn — cài thêm
trong CI/Dockerfile của dự án nếu cần:
- **Docker CLI** — nếu cần build/push image, dùng image
[`docker-node`](../docker-node) thay thế.
- **Python** — dùng image [`node-python`](../node-python).
- **Make**, **jq**, **zip/unzip**, **openssh-client**… — `apt-get install` trong
pipeline khi cần.
- **Các Go tool cụ thể của dự án** (vd: `mockgen`, `protoc-gen-go`,
`wire`…) — `go install ...@<version>` trong bước CI, vì mỗi dự án cần
phiên bản khác nhau.
- **Hồ sơ Git (user.name/user.email)** — tự cấu hình trong CI.
## Nâng cấp
- **Tự động (mặc định)**: [Renovate](../renovate.json) theo dõi `GO_VERSION`
`GOLANGCI_LINT_VERSION`, tự mở PR (và auto-merge theo quy tắc ở trên) khi có
release mới. PR merge → workflow build lại image.
- **Thủ công** (khi cần bump major, vd golangci-lint v2→v3 hoặc Go 1.26→1.27):
sửa trực tiếp `ARG` trong [Dockerfile](Dockerfile) rồi push.
- Image cũng được build lại hàng tuần theo lịch (`cron`) trong workflow.
+34 -1
View File
@@ -1,3 +1,36 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json"
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"customManagers": [
{
"customType": "regex",
"description": "Bump golangci-lint version ARG trong node-go/Dockerfile",
"fileMatch": ["node-go/Dockerfile$"],
"matchStrings": ["ARG GOLANGCI_LINT_VERSION=(?<currentValue>\\S+)"],
"datasourceTemplate": "github-releases",
"depNameTemplate": "golangci/golangci-lint"
},
{
"customType": "regex",
"description": "Bump Go version ARG trong node-go/Dockerfile",
"fileMatch": ["node-go/Dockerfile$"],
"matchStrings": ["ARG GO_VERSION=(?<currentValue>\\S+)"],
"datasourceTemplate": "golang-version",
"depNameTemplate": "go"
}
],
"packageRules": [
{
"description": "golangci-lint: auto-merge minor/patch, major (vd v2->v3) can review",
"matchDatasources": ["github-releases"],
"matchPackageNames": ["golangci/golangci-lint"],
"matchUpdateTypes": ["minor", "patch"],
"automerge": true
},
{
"description": "Go: chi auto-merge patch; minor (vd 1.26->1.27) can review thu cong",
"matchDatasources": ["golang-version"],
"matchUpdateTypes": ["patch"],
"automerge": true
}
]
}