Compare commits

...

2 Commits

Author SHA1 Message Date
TakahashiNguyen 2913fa0d73 fix: better ci and docker build (#20)
Release package / release (push) Successful in 28m17s
Co-authored-by: TakahashiNg <83152264+TakahashiNguyen@users.noreply.github.com>
Reviewed-on: #20
2026-03-31 07:52:42 +00:00
gitea-actions 423d4e3436 chore: release [ci skip] 2026-03-31 07:21:05 +00:00
7 changed files with 33 additions and 30 deletions
+18 -18
View File
@@ -84,24 +84,6 @@ jobs:
VERSION=$(node -p "require('./package.json').version") VERSION=$(node -p "require('./package.json').version")
echo "version=$VERSION" >> $GITHUB_OUTPUT echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Commit & Push Changes
if: gitea.ref == 'refs/heads/main'
run: |
if [ -n "$(git status --porcelain)" ]; then
git config --global user.name "gitea-actions"
git config --global user.email "actions-user@noreply.git.demonkernel.io.vn"
REPO_NAME="${{ gitea.repository }}"
git remote set-url origin ssh://git@$TARGET_IP:222/${REPO_NAME}.git
git rm -r --cached .
git add .
git commit -m "chore: release [ci skip]"
git push
fi
- name: Log in to Gitea Container Registry - name: Log in to Gitea Container Registry
if: gitea.ref == 'refs/heads/main' if: gitea.ref == 'refs/heads/main'
uses: docker/login-action@v3 uses: docker/login-action@v3
@@ -133,3 +115,21 @@ jobs:
git.demonkernel.io.vn/${{ steps.meta.outputs.repo }}:latest git.demonkernel.io.vn/${{ steps.meta.outputs.repo }}:latest
git.demonkernel.io.vn/${{ steps.meta.outputs.repo }}:${{ steps.meta.outputs.version }} git.demonkernel.io.vn/${{ steps.meta.outputs.repo }}:${{ steps.meta.outputs.version }}
- name: Commit & Push Changes
if: gitea.ref == 'refs/heads/main'
run: |
if [ -n "$(git status --porcelain)" ]; then
git config --global user.name "gitea-actions"
git config --global user.email "actions-user@noreply.git.demonkernel.io.vn"
REPO_NAME="${{ gitea.repository }}"
git remote set-url origin ssh://git@$TARGET_IP:222/${REPO_NAME}.git
git rm -r --cached .
git add .
git commit -m "chore: release [ci skip]"
git push
fi
+1 -2
View File
@@ -19,8 +19,7 @@ COPY . .
# Tắt dữ liệu thu thập của Next.js trong quá trình build # Tắt dữ liệu thu thập của Next.js trong quá trình build
ENV NEXT_TELEMETRY_DISABLED 1 ENV NEXT_TELEMETRY_DISABLED 1
RUN npm install -g pnpm RUN npm run build
RUN pnpm run build
# --- Giai đoạn 3: Runner (Sản phẩm cuối) --- # --- Giai đoạn 3: Runner (Sản phẩm cuối) ---
FROM node:25-alpine AS runner FROM node:25-alpine AS runner
+1 -1
View File
@@ -10,7 +10,7 @@ import type { NextConfig } from "next";
* Docs: https://nextjs.org/docs/app/api-reference/next-config-js * Docs: https://nextjs.org/docs/app/api-reference/next-config-js
*/ */
const nextConfig: NextConfig = { const nextConfig: NextConfig = {
output: 'standalone', output: "standalone",
images: { images: {
remotePatterns: [ remotePatterns: [
{ {
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "temp", "name": "temp",
"version": "1.0.7", "version": "1.0.8",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "temp", "name": "temp",
"version": "1.0.7", "version": "1.0.8",
"dependencies": { "dependencies": {
"next": "16.1.7", "next": "16.1.7",
"php": "^1.1.0", "php": "^1.1.0",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "temp", "name": "temp",
"version": "1.0.7", "version": "1.0.8",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev", "dev": "next dev",
Binary file not shown.
+10 -6
View File
@@ -9,11 +9,15 @@ if (!version) {
const zipPath = `release-v${version}.zip`; // Thêm version vào tên file cho dễ quản lý const zipPath = `release-v${version}.zip`; // Thêm version vào tên file cho dễ quản lý
console.log(`📦 Đang chuẩn bị đóng gói App Router Standalone cho version: ${version}...`); console.log(
`📦 Đang chuẩn bị đóng gói App Router Standalone cho version: ${version}...`,
);
// Kiểm tra xem đã build chưa // Kiểm tra xem đã build chưa
if (!fs.existsSync(".next/standalone")) { if (!fs.existsSync(".next/standalone")) {
console.error("❌ Thư mục .next/standalone không tồn tại. Hãy chạy 'pnpm build' trước!"); console.error(
"❌ Thư mục .next/standalone không tồn tại. Hãy chạy 'pnpm build' trước!",
);
process.exit(1); process.exit(1);
} }
@@ -27,10 +31,10 @@ if (!fs.existsSync(".next/standalone")) {
try { try {
// Tạo thư mục tạm để cấu trúc lại file trước khi nén // Tạo thư mục tạm để cấu trúc lại file trước khi nén
execSync("rm -rf temp_release && mkdir -p temp_release"); execSync("rm -rf temp_release && mkdir -p temp_release");
console.log("🚚 Đang sao chép các file standalone..."); console.log("🚚 Đang sao chép các file standalone...");
execSync("cp -r .next/standalone/. temp_release/"); execSync("cp -r .next/standalone/. temp_release/");
console.log("🚚 Đang sao chép static và public..."); console.log("🚚 Đang sao chép static và public...");
execSync("mkdir -p temp_release/.next/static"); execSync("mkdir -p temp_release/.next/static");
execSync("cp -r .next/static/. temp_release/.next/static/"); execSync("cp -r .next/static/. temp_release/.next/static/");
@@ -44,9 +48,9 @@ try {
execSync("rm -rf temp_release"); execSync("rm -rf temp_release");
console.log(`✅ Đã tạo file thành công: ${zipPath}`); console.log(`✅ Đã tạo file thành công: ${zipPath}`);
execSync("pnpm format"); execSync("pnpm format");
} catch (error) { } catch (error) {
console.error("❌ Có lỗi xảy ra trong quá trình nén:", error.message); console.error("❌ Có lỗi xảy ra trong quá trình nén:", error.message);
process.exit(1); process.exit(1);
} }