-
Notifications
You must be signed in to change notification settings - Fork 5
/
.gitlab-ci.yml
67 lines (59 loc) · 1.54 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
image: node:18
variables:
DOCS_IMAGE: $CI_REGISTRY_IMAGE/docs
cache:
paths:
- .pnpm-store
stages:
- build_docs
- build_docker
build_docs:
stage: build_docs
before_script:
- npm install -g pnpm
- pnpm config set store-dir .pnpm-store
script:
- pnpm install
- pnpm run build
artifacts:
paths:
- .next/
build_docker:
stage: build_docker
image: docker:latest
services:
- docker:dind
before_script:
- echo "$CI_REGISTRY_PASSWORD" | docker login $CI_REGISTRY -u $CI_REGISTRY_USER --password-stdin
script:
- |
cat <<EOF > Dockerfile
FROM node:22.9.0-alpine AS builder
WORKDIR /app
RUN npm install -g [email protected]
COPY pnpm-lock.yaml ./
COPY package*.json ./
RUN pnpm install
COPY . .
RUN ls -la /app
RUN pnpm list
RUN node --version
RUN pnpm --version
RUN pnpm run build
FROM node:22.9.0-alpine
WORKDIR /app
RUN npm install -g [email protected]
COPY --from=builder /app/package*.json ./
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/public ./public
COPY --from=builder /app/pages ./pages
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/next.config.mjs ./next.config.mjs
ENV NODE_ENV=production
CMD ["pnpm", "start"]
EOF
- docker build -t $DOCS_IMAGE:$CI_COMMIT_REF_SLUG -t $DOCS_IMAGE:latest .
- docker push $DOCS_IMAGE:$CI_COMMIT_REF_SLUG
- docker push $DOCS_IMAGE:latest
only:
- main