-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from starpep-web/rewrite
Rewrite to Next.js 14
- Loading branch information
Showing
541 changed files
with
21,518 additions
and
20,724 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
# Ignore everything by default | ||
# Ignore everything by default. | ||
* | ||
|
||
# Allow the public project files. | ||
# Manually add what to use. | ||
!public | ||
!src | ||
!Dockerfile | ||
!README.md | ||
!package.json | ||
!package-lock.json | ||
!next-env.d.ts | ||
!entrypoint.sh | ||
!graphql-codegen.ts | ||
!LICENSE | ||
!next.config.js | ||
!next-env.d.ts | ||
!package*.json | ||
!remote-schema.graphql | ||
!tsconfig.json | ||
!components | ||
!lib | ||
!pages | ||
!public | ||
!styles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ node_modules | |
.next | ||
build | ||
next-env.d.ts | ||
src/lib/services/strapi/graphql/__generated__/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
{ | ||
"extends": [ | ||
"greencoast/react-ts" | ||
"@moonstar-x/eslint-config/rules/react/typescript" | ||
], | ||
"rules": { | ||
"no-extra-parens": "off", | ||
"camelcase": "off" | ||
}, | ||
"globals": { | ||
"RequestInit": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Build Docker Image | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
image_tag: | ||
type: string | ||
required: true | ||
ghcr_username: | ||
type: string | ||
required: true | ||
ghcr_image_name: | ||
type: string | ||
required: true | ||
secrets: | ||
ghcr_token: | ||
required: true | ||
|
||
jobs: | ||
build: | ||
name: Build Docker Image | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout the Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Cache Docker Layers | ||
uses: actions/cache@v4 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ inputs.ghcr_username }} | ||
password: ${{ secrets.ghcr_token }} | ||
|
||
- name: Build & Push Docker Image | ||
id: docker_build | ||
uses: docker/build-push-action@v6 | ||
env: | ||
GHCR_IMAGE: ghcr.io/${{ inputs.ghcr_image_name }} | ||
with: | ||
context: . | ||
push: true | ||
tags: | | ||
${{ env.GHCR_IMAGE }}:${{ inputs.image_tag }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache | ||
platforms: linux/amd64,linux/arm64/v8 | ||
|
||
- name: Image Digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Run Tests | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
test: | ||
name: Run Tests | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout the Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: npm | ||
|
||
- name: Install Dependencies | ||
run: npm ci | ||
|
||
- name: Run Type Checks | ||
run: npm run type-check | ||
|
||
- name: Run Linter | ||
run: npm run lint | ||
|
||
- name: Run Tests | ||
run: npm run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: On Pull Request | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- edited | ||
- synchronize | ||
- reopened | ||
|
||
jobs: | ||
test: | ||
name: Run Tests | ||
uses: ./.github/workflows/callable-test.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: On Push (Main) | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
name: Run Tests | ||
uses: ./.github/workflows/callable-test.yml | ||
|
||
build: | ||
name: Build Docker Image | ||
uses: ./.github/workflows/callable-build.yml | ||
needs: | ||
- test | ||
with: | ||
ghcr_username: ${{ github.actor }} | ||
ghcr_image_name: ${{ github.repository }} | ||
image_tag: latest | ||
secrets: | ||
ghcr_token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,5 +34,5 @@ yarn-error.log* | |
# typescript | ||
*.tsbuildinfo | ||
|
||
# secrets | ||
*.env | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,46 @@ | ||
# Build Stage | ||
FROM node:16-alpine AS build | ||
FROM node:20.18.0-alpine AS base | ||
|
||
WORKDIR /tmp/app | ||
FROM base AS deps | ||
|
||
RUN apk add --no-cache libc6-compat | ||
WORKDIR /tmp/app | ||
|
||
COPY package*.json ./ | ||
RUN npm ci | ||
|
||
ENV BUILDING_STAGE true | ||
FROM base AS build | ||
|
||
ENV NODE_ENV=production | ||
WORKDIR /tmp/app | ||
|
||
COPY --from=deps /tmp/app/node_modules ./node_modules | ||
COPY . . | ||
RUN npm run build | ||
|
||
# Image | ||
FROM node:16-alpine | ||
# Any NEXT_PUBLIC env variables must be added here for them to work. | ||
ENV NEXT_PUBLIC_URL=NEXT_PUBLIC_URL | ||
ENV NEXT_PUBLIC_DOWNLOADS_URL=NEXT_PUBLIC_DOWNLOADS_URL | ||
ENV NEXT_PUBLIC_STRAPI_PROTO=NEXT_PUBLIC_STRAPI_PROTO | ||
ENV NEXT_PUBLIC_STRAPI_HOST=NEXT_PUBLIC_STRAPI_HOST | ||
ENV NEXT_PUBLIC_STRAPI_PORT=NEXT_PUBLIC_STRAPI_PORT | ||
|
||
WORKDIR /opt/app | ||
ENV NODE_ENV production | ||
RUN npm run build | ||
|
||
RUN addgroup --system --gid 1001 nodejs | ||
RUN adduser --system --uid 1001 nextjs | ||
FROM base AS runner | ||
|
||
COPY README.md Dockerfile ./ | ||
COPY --from=build /tmp/app/public ./public | ||
COPY --from=build --chown=nextjs:nodejs /tmp/app/.next/standalone ./ | ||
COPY --from=build --chown=nextjs:nodejs /tmp/app/.next/static ./.next/static | ||
RUN adduser -D starpep-web-frontend | ||
USER starpep-web-frontend | ||
|
||
USER nextjs | ||
WORKDIR /opt/app | ||
|
||
ENV PORT 3000 | ||
COPY --from=build --chown=starpep-web-frontend /tmp/app/public ./public | ||
COPY --from=build --chown=starpep-web-frontend /tmp/app/.next/standalone ./ | ||
COPY --from=build --chown=starpep-web-frontend /tmp/app/.next/static ./.next/static | ||
|
||
ENV NODE_ENV=production | ||
ENV PORT=3000 | ||
EXPOSE 3000 | ||
|
||
COPY --chown=starpep-web-frontend entrypoint.sh ./ | ||
RUN chmod +x /opt/app/entrypoint.sh | ||
|
||
ENTRYPOINT ["./entrypoint.sh"] | ||
CMD ["node", "server.js"] |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.