feat: Add initial Docker setup and development environment documentation.
This commit is contained in:
parent
42b7399868
commit
ca65dbff4c
5 changed files with 124 additions and 28 deletions
38
Frontend-Learner/Dockerfile
Normal file
38
Frontend-Learner/Dockerfile
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
# --- Build Stage ---
|
||||
FROM node:20-alpine AS build-stage
|
||||
|
||||
# กำหนดโฟลเดอร์ทำงานใน Container
|
||||
WORKDIR /app
|
||||
|
||||
# คัดลอกไฟล์จัดการ dependencies
|
||||
COPY package*.json ./
|
||||
|
||||
# ติดตั้ง dependencies (ใช้ npm ci เพื่อความแม่นยำของเวอร์ชัน)
|
||||
RUN npm ci
|
||||
|
||||
# คัดลอกไฟล์ทั้งหมดในโปรเจกต์
|
||||
COPY . .
|
||||
|
||||
# สั่ง Build โปรเจกต์ Nuxt 3 (จะได้โฟลเดอร์ .output)
|
||||
RUN npm run build
|
||||
|
||||
# --- Production Stage ---
|
||||
FROM node:20-alpine AS production-stage
|
||||
|
||||
# กำหนดโฟลเดอร์ทำงาน
|
||||
WORKDIR /app
|
||||
|
||||
# คัดลอกเฉพาะโฟลเดอร์ .output ที่ได้จากการ build (ประหยัดพื้นที่ Container)
|
||||
COPY --from=build-stage /app/.output ./.output
|
||||
|
||||
# กำหนดตัวแปรสภาพแวดล้อม (Environment Variables) สำหรับ Production
|
||||
ENV PORT=3000
|
||||
ENV NODE_ENV=production
|
||||
|
||||
# แจ้ง Port ที่ Container จะใช้งาน
|
||||
EXPOSE 3000
|
||||
|
||||
# คำสั่งสำหรับเริ่มการทำงานของ Nuxt 3 Server
|
||||
# ใช้ node รันไฟล์ entry point ที่สร้างจากการ build
|
||||
CMD ["node", ".output/server/index.mjs"]
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue