Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
VCCI-News
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Văn Hoàng
VCCI-News
Commits
7e367373
Commit
7e367373
authored
Aug 06, 2026
by
Lê Bảo Hồng Đức
☄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[tag]0.1-vcci
parent
b3589a95
Pipeline
#52398
failed with stages
in 43 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
7 deletions
+60
-7
base.Dockerfile
.docker/base.Dockerfile
+10
-3
build.Dockerfile
.docker/build.Dockerfile
+11
-4
.dockerignore
.dockerignore
+39
-0
No files found.
.docker/base.Dockerfile
View file @
7e367373
FROM node:22-alpine
FROM node:22-alpine
AS base
WORKDIR /app
WORKDIR /app
COPY package*.json ./
RUN npm install
# Cài pnpm qua corepack — cách chính thức của Node.js
RUN corepack enable && corepack prepare pnpm@latest --activate
# Copy manifest + lockfile trước để tận dụng Docker layer cache
COPY package.json pnpm-lock.yaml* ./
# Cài dependencies production + dev (cần dev vì next build, eslint, orval tại build stage)
RUN pnpm install --frozen-lockfile
.docker/build.Dockerfile
View file @
7e367373
...
@@ -6,11 +6,14 @@ ARG NEXT_PUBLIC_FRONTEND_HOST=https://news.vccihcm.vn
...
@@ -6,11 +6,14 @@ ARG NEXT_PUBLIC_FRONTEND_HOST=https://news.vccihcm.vn
ENV NEXT_PUBLIC_BACKEND_HOST=$NEXT_PUBLIC_BACKEND_HOST
ENV NEXT_PUBLIC_BACKEND_HOST=$NEXT_PUBLIC_BACKEND_HOST
ENV NEXT_PUBLIC_FRONTEND_HOST=$NEXT_PUBLIC_FRONTEND_HOST
ENV NEXT_PUBLIC_FRONTEND_HOST=$NEXT_PUBLIC_FRONTEND_HOST
# Copy toàn bộ source (đã được .dockerignore lọc trừ node_modules / .next / openapi)
COPY . .
COPY . .
# Generate API client + build
RUN node scripts/generate-api.mjs
RUN node scripts/generate-api.mjs
RUN npm run build
RUN
p
npm run build
# ----------------- Production stage -----------------
FROM node:22-alpine AS production
FROM node:22-alpine AS production
WORKDIR /app
WORKDIR /app
...
@@ -20,15 +23,19 @@ ARG NEXT_PUBLIC_FRONTEND_HOST=https://news.vccihcm.vn
...
@@ -20,15 +23,19 @@ ARG NEXT_PUBLIC_FRONTEND_HOST=https://news.vccihcm.vn
ENV NEXT_PUBLIC_BACKEND_HOST=$NEXT_PUBLIC_BACKEND_HOST
ENV NEXT_PUBLIC_BACKEND_HOST=$NEXT_PUBLIC_BACKEND_HOST
ENV NEXT_PUBLIC_FRONTEND_HOST=$NEXT_PUBLIC_FRONTEND_HOST
ENV NEXT_PUBLIC_FRONTEND_HOST=$NEXT_PUBLIC_FRONTEND_HOST
COPY --from=builder /app/package*.json ./
RUN corepack enable && corepack prepare pnpm@latest --activate
# Copy lockfile + manifest + node_modules từ builder
COPY --from=builder /app/package.json ./
COPY --from=builder /app/pnpm-lock.yaml* ./
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/node_modules ./node_modules
RUN npm prune --production
# Prune dev deps để giảm image size
RUN pnpm prune --prod
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/public ./public
COPY --from=builder /app/public ./public
EXPOSE 3000
EXPOSE 3000
CMD ["npm", "run", "start"]
CMD ["
p
npm", "run", "start"]
.dockerignore
0 → 100644
View file @
7e367373
# =====================================================================
# VCCI-News .dockerignore
# Tránh copy các file không cần thiết vào Docker image.
# Bắt buộc có để build Docker nhất quán giữa các môi trường.
# =====================================================================
# Node / Next.js
node_modules
.pnp
.pnp.js
.yarn/install-state.gz
# Build output
.next/
out/
build/
dist/
# Misc
.DS_Store
*.pem
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.vercel
.turbo
.idea
.vscode
# Env / secrets
.env*.local
.env.production.local
# Test
coverage
.nyc_output
# Swagger spec chỉ dùng cho local dev — base image nên dùng BE thật
openapi/
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment