Skip to content

Commit aed9bf4

Browse files
authored
Merge pull request #59 from starpep-web/rewrite
Rewrite to Next.js 14
2 parents d00ec3f + 06acc63 commit aed9bf4

File tree

541 files changed

+21518
-20724
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

541 files changed

+21518
-20724
lines changed

.dockerignore

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
# Ignore everything by default
1+
# Ignore everything by default.
22
*
33

4-
# Allow the public project files.
4+
# Manually add what to use.
5+
!public
6+
!src
57
!Dockerfile
6-
!README.md
7-
!package.json
8-
!package-lock.json
9-
!next-env.d.ts
8+
!entrypoint.sh
9+
!graphql-codegen.ts
10+
!LICENSE
1011
!next.config.js
12+
!next-env.d.ts
13+
!package*.json
14+
!remote-schema.graphql
1115
!tsconfig.json
12-
!components
13-
!lib
14-
!pages
15-
!public
16-
!styles

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ node_modules
22
.next
33
build
44
next-env.d.ts
5+
src/lib/services/strapi/graphql/__generated__/*

.eslintrc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
{
22
"extends": [
3-
"greencoast/react-ts"
3+
"@moonstar-x/eslint-config/rules/react/typescript"
44
],
55
"rules": {
6-
"no-extra-parens": "off",
76
"camelcase": "off"
7+
},
8+
"globals": {
9+
"RequestInit": true
810
}
911
}

.github/workflows/callable-build.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Build Docker Image
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
image_tag:
7+
type: string
8+
required: true
9+
ghcr_username:
10+
type: string
11+
required: true
12+
ghcr_image_name:
13+
type: string
14+
required: true
15+
secrets:
16+
ghcr_token:
17+
required: true
18+
19+
jobs:
20+
build:
21+
name: Build Docker Image
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- name: Checkout the Repository
26+
uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 0
29+
30+
- name: Set up Docker Buildx
31+
uses: docker/setup-buildx-action@v3
32+
33+
- name: Cache Docker Layers
34+
uses: actions/cache@v4
35+
with:
36+
path: /tmp/.buildx-cache
37+
key: ${{ runner.os }}-buildx-${{ github.sha }}
38+
restore-keys: |
39+
${{ runner.os }}-buildx-
40+
41+
- name: Login to GitHub Container Registry
42+
uses: docker/login-action@v3
43+
with:
44+
registry: ghcr.io
45+
username: ${{ inputs.ghcr_username }}
46+
password: ${{ secrets.ghcr_token }}
47+
48+
- name: Build & Push Docker Image
49+
id: docker_build
50+
uses: docker/build-push-action@v6
51+
env:
52+
GHCR_IMAGE: ghcr.io/${{ inputs.ghcr_image_name }}
53+
with:
54+
context: .
55+
push: true
56+
tags: |
57+
${{ env.GHCR_IMAGE }}:${{ inputs.image_tag }}
58+
cache-from: type=local,src=/tmp/.buildx-cache
59+
cache-to: type=local,dest=/tmp/.buildx-cache
60+
platforms: linux/amd64,linux/arm64/v8
61+
62+
- name: Image Digest
63+
run: echo ${{ steps.docker_build.outputs.digest }}

.github/workflows/callable-test.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Run Tests
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
test:
8+
name: Run Tests
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout the Repository
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Set up Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: 20
21+
cache: npm
22+
23+
- name: Install Dependencies
24+
run: npm ci
25+
26+
- name: Run Type Checks
27+
run: npm run type-check
28+
29+
- name: Run Linter
30+
run: npm run lint
31+
32+
- name: Run Tests
33+
run: npm run test

.github/workflows/on-pr.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: On Pull Request
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
- reopened
10+
11+
jobs:
12+
test:
13+
name: Run Tests
14+
uses: ./.github/workflows/callable-test.yml

.github/workflows/on-push-main.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: On Push (Main)
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
test:
10+
name: Run Tests
11+
uses: ./.github/workflows/callable-test.yml
12+
13+
build:
14+
name: Build Docker Image
15+
uses: ./.github/workflows/callable-build.yml
16+
needs:
17+
- test
18+
with:
19+
ghcr_username: ${{ github.actor }}
20+
ghcr_image_name: ${{ github.repository }}
21+
image_tag: latest
22+
secrets:
23+
ghcr_token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ yarn-error.log*
3434
# typescript
3535
*.tsbuildinfo
3636

37+
# secrets
3738
*.env
38-
.idea

Dockerfile

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,46 @@
1-
# Build Stage
2-
FROM node:16-alpine AS build
1+
FROM node:20.18.0-alpine AS base
32

4-
WORKDIR /tmp/app
3+
FROM base AS deps
54

6-
RUN apk add --no-cache libc6-compat
5+
WORKDIR /tmp/app
76

87
COPY package*.json ./
98
RUN npm ci
109

11-
ENV BUILDING_STAGE true
10+
FROM base AS build
11+
12+
ENV NODE_ENV=production
13+
WORKDIR /tmp/app
14+
15+
COPY --from=deps /tmp/app/node_modules ./node_modules
1216
COPY . .
13-
RUN npm run build
1417

15-
# Image
16-
FROM node:16-alpine
18+
# Any NEXT_PUBLIC env variables must be added here for them to work.
19+
ENV NEXT_PUBLIC_URL=NEXT_PUBLIC_URL
20+
ENV NEXT_PUBLIC_DOWNLOADS_URL=NEXT_PUBLIC_DOWNLOADS_URL
21+
ENV NEXT_PUBLIC_STRAPI_PROTO=NEXT_PUBLIC_STRAPI_PROTO
22+
ENV NEXT_PUBLIC_STRAPI_HOST=NEXT_PUBLIC_STRAPI_HOST
23+
ENV NEXT_PUBLIC_STRAPI_PORT=NEXT_PUBLIC_STRAPI_PORT
1724

18-
WORKDIR /opt/app
19-
ENV NODE_ENV production
25+
RUN npm run build
2026

21-
RUN addgroup --system --gid 1001 nodejs
22-
RUN adduser --system --uid 1001 nextjs
27+
FROM base AS runner
2328

24-
COPY README.md Dockerfile ./
25-
COPY --from=build /tmp/app/public ./public
26-
COPY --from=build --chown=nextjs:nodejs /tmp/app/.next/standalone ./
27-
COPY --from=build --chown=nextjs:nodejs /tmp/app/.next/static ./.next/static
29+
RUN adduser -D starpep-web-frontend
30+
USER starpep-web-frontend
2831

29-
USER nextjs
32+
WORKDIR /opt/app
3033

31-
ENV PORT 3000
34+
COPY --from=build --chown=starpep-web-frontend /tmp/app/public ./public
35+
COPY --from=build --chown=starpep-web-frontend /tmp/app/.next/standalone ./
36+
COPY --from=build --chown=starpep-web-frontend /tmp/app/.next/static ./.next/static
37+
38+
ENV NODE_ENV=production
39+
ENV PORT=3000
3240
EXPOSE 3000
3341

42+
COPY --chown=starpep-web-frontend entrypoint.sh ./
43+
RUN chmod +x /opt/app/entrypoint.sh
44+
45+
ENTRYPOINT ["./entrypoint.sh"]
3446
CMD ["node", "server.js"]

Jenkinsfile

Lines changed: 0 additions & 131 deletions
This file was deleted.

0 commit comments

Comments
 (0)