Skip to content

Commit 17b5375

Browse files
committed
adding next APIs, deployment configuration
1 parent bf51307 commit 17b5375

Some content is hidden

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

47 files changed

+2023
-14207
lines changed

.dockerignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
**/node_modules
2+
**/.next
3+
**/compiled
4+
**/dist
5+
**/build
6+
**/.env
7+
**/.env*
8+
**/docker
9+
**/docs
10+
**/.git
11+
**/.DS_Store
12+
**/.eslintrc.json
13+
**/.gitignore
14+
**/.github
15+
**/.dockerignore
16+
**/readme.md

.prettierrc.json

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
{
2-
"arrowParens": "always",
3-
"bracketSpacing": true,
4-
"bracketSameLine": true,
5-
"printWidth": 80,
6-
"proseWrap": "never",
7-
"singleQuote": true,
8-
"trailingComma": "all"
2+
"arrowParens": "always",
3+
"bracketSpacing": true,
4+
"bracketSameLine": true,
5+
"printWidth": 80,
6+
"proseWrap": "never",
7+
"singleQuote": true,
8+
"semi": true,
9+
"tabWidth": 4,
10+
"trailingComma": "all",
11+
"overrides": [
12+
{
13+
"files": ["*.jsx", "*.tsx", "*.html"],
14+
"options": {
15+
"tabWidth": 2
16+
}
17+
}
18+
]
919
}

app/.dockerignore

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

app/.eslintrc.json

Lines changed: 21 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,22 @@
11
{
2-
"parser": "@typescript-eslint/parser",
3-
"env": {
4-
"browser": true,
5-
"es2021": true
6-
},
7-
"extends": [
8-
"next/core-web-vitals",
9-
"standard-with-typescript"
10-
],
11-
"parserOptions": {
12-
"ecmaVersion": "latest",
13-
"sourceType": "module"
14-
},
15-
"ignorePatterns": [
16-
"scripts/**",
17-
"build/**"
18-
],
19-
"rules": {
20-
"@typescript-eslint/indent": "off",
21-
"@typescript-eslint/quotes": "off",
22-
"@typescript-eslint/explicit-function-return-type": "off",
23-
"@typescript-eslint/semi": [
24-
"error",
25-
"always"
26-
],
27-
"@typescript-eslint/no-misused-promises": "off",
28-
"@typescript-eslint/space-before-function-paren": "off",
29-
"@typescript-eslint/comma-dangle": [
30-
"error",
31-
"always-multiline"
32-
]
33-
}
34-
}
2+
"parser": "@typescript-eslint/parser",
3+
"env": {
4+
"browser": true,
5+
"es2021": true
6+
},
7+
"extends": ["next/core-web-vitals", "standard-with-typescript"],
8+
"parserOptions": {
9+
"ecmaVersion": "latest",
10+
"sourceType": "module"
11+
},
12+
"ignorePatterns": ["scripts/**", "build/**"],
13+
"rules": {
14+
"@typescript-eslint/indent": "off",
15+
"@typescript-eslint/quotes": "off",
16+
"@typescript-eslint/explicit-function-return-type": "off",
17+
"@typescript-eslint/semi": ["error", "always"],
18+
"@typescript-eslint/no-misused-promises": "off",
19+
"@typescript-eslint/space-before-function-paren": "off",
20+
"@typescript-eslint/comma-dangle": ["error", "always-multiline"]
21+
}
22+
}

app/Dockerfile

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,41 @@
1-
FROM node:20-bullseye-slim
2-
3-
ARG $CWD
4-
1+
FROM node:20-bullseye-slim AS base
52
WORKDIR /usr/src/app
63

7-
COPY $CWD/package.json .
4+
FROM base as deps
85

6+
COPY ./app/package.json /usr/src/app
7+
COPY ./package-lock.json /usr/src/app
98
RUN npm install
109

11-
COPY $CWD/ .
10+
FROM base as dev
11+
COPY --from=deps /usr/src/app/node_modules ./node_modules
12+
COPY ./app /usr/src/app
1213

14+
FROM base as builder
15+
COPY --from=deps /usr/src/app/node_modules ./node_modules
16+
COPY ./app /usr/src/app
1317
RUN npm run build
1418

15-
CMD npm start -- -p $PORT
19+
FROM base as runner
20+
ENV NODE_ENV production
21+
RUN addgroup --system --gid 1001 nodejs \
22+
&& adduser --system --uid 1001 nextjs
23+
24+
25+
RUN mkdir .next \
26+
&& chown -R nextjs:nodejs .next
27+
28+
COPY --from=builder --chown=nextjs:nodejs /usr/src/app/.next/standalone ./
29+
COPY --from=builder --chown=nextjs:nodejs /usr/src/app/.next/static ./.next/static
30+
31+
USER nextjs
32+
33+
ENV PORT 3000
34+
35+
EXPOSE ${PORT}
36+
37+
# set hostname to localhost
38+
ENV HOSTNAME "0.0.0.0"
39+
40+
CMD ["node", "server.js"]
41+

app/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-opti
2424

2525
To learn more about Next.js, take a look at the following resources:
2626

27-
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28-
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
27+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
2929

3030
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
3131

app/next.config.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
/** @type {import('next').NextConfig} */
22
const nextConfig = {
3-
images: {
4-
remotePatterns: [
5-
{
6-
protocol: 'https',
7-
hostname: 'i.ytimg.com',
8-
},
9-
],
10-
},
3+
output: 'standalone',
4+
images: {
5+
remotePatterns: [
6+
{
7+
protocol: 'https',
8+
hostname: 'i.ytimg.com',
9+
},
10+
],
11+
},
1112
};
1213

1314
module.exports = nextConfig;

0 commit comments

Comments
 (0)