ken4 commited on
Commit
46f5e34
·
verified ·
1 Parent(s): 096dde1

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -14
Dockerfile CHANGED
@@ -1,36 +1,34 @@
1
- # ===== BUILD STAGE =====
2
  FROM node:20 AS builder
3
 
4
  WORKDIR /app
5
 
6
- # Clone private repo
7
  RUN --mount=type=secret,id=GITHUB_REPO,required=true \
8
  git clone $(cat /run/secrets/GITHUB_REPO) /app
9
 
10
- # Install dependencies untuk root (Express + backend)
11
  RUN npm install
12
 
13
- # Build Nuxt STATIC
14
  WORKDIR /app/nuxt
15
- RUN yarn install --ignore-engines
16
- RUN yarn generate
17
 
18
- # Kembali ke root workspace
19
  WORKDIR /app
20
 
21
- # Pastikan folder public ada
22
- RUN mkdir -p public
23
-
24
- # Copy hasil build nuxt → /public
25
- RUN cp -r /app/nuxt/dist/* /app/public/
26
 
27
 
28
- # ===== RUNTIME STAGE =====
 
 
29
  FROM node:20
30
 
31
  WORKDIR /app
32
 
33
- # Copy hasil build dari stage builder
34
  COPY --from=builder /app /app
35
 
36
  RUN chown -R node:node /app
 
 
1
  FROM node:20 AS builder
2
 
3
  WORKDIR /app
4
 
5
+ # Clone repo privat
6
  RUN --mount=type=secret,id=GITHUB_REPO,required=true \
7
  git clone $(cat /run/secrets/GITHUB_REPO) /app
8
 
9
+ # Install dependencies untuk Express
10
  RUN npm install
11
 
12
+ # Build Nuxt (STATIC)
13
  WORKDIR /app/nuxt
14
+ RUN npm install
15
+ RUN npm run generate
16
 
17
+ # Kembali ke root
18
  WORKDIR /app
19
 
20
+ # Kosongkan public, lalu isi dengan hasil Nuxt
21
+ RUN rm -rf ./public && mkdir -p ./public
22
+ RUN cp -r /app/nuxt/dist/* ./public/
 
 
23
 
24
 
25
+ # ===============================
26
+ # RUNTIME
27
+ # ===============================
28
  FROM node:20
29
 
30
  WORKDIR /app
31
 
 
32
  COPY --from=builder /app /app
33
 
34
  RUN chown -R node:node /app