Skip to content

Commit 3613dd5

Browse files
committed
[fix] some Deployment detail bugs
1 parent 3f0aff2 commit 3613dd5

File tree

7 files changed

+415
-536
lines changed

7 files changed

+415
-536
lines changed

.github/workflows/deploy-production.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ on:
99
- v*
1010
env:
1111
ARTIFACT_PATH: /tmp/artifact.tar
12-
BOX_NAME: next-bootstrap-ts
13-
BOX_URL: idea2app/next-bootstrap-ts
12+
BOX_NAME: web-server
13+
BOX_URL: idea2app/web-server
1414

1515
jobs:
1616
deploy_docker_image:

Dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ COPY . /app
1010
WORKDIR /app
1111

1212
FROM base AS prod-deps
13-
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm i --prod --frozen-lockfile
13+
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm i -P --frozen-lockfile --ignore-scripts
1414

1515
FROM base AS build
16-
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm i --frozen-lockfile
16+
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm i --frozen-lockfile
1717
RUN pnpm build
1818

1919
FROM base
20-
COPY --from=prod-deps /app/node_modules /app/node_modules
21-
COPY --from=build /app/dist /app/dist
20+
COPY --from=prod-deps /app/node_modules ./node_modules
21+
COPY --from=build /app/public ./public
22+
COPY --from=build /app/.next ./.next
2223
EXPOSE 3000
2324
CMD ["npm", "start"]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Next-Bootstrap.ts
1+
# idea2app OWS
22

33
[React][1] project scaffold based on [TypeScript][2], [Next.js][3], [Bootstrap][4] & [Workbox][5]. And this project bootstrapped with [`create-next-app`][6].
44

docker-compose.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,8 @@ networks:
44
idea2app:
55

66
services:
7-
next-bootstrap-ts:
8-
image: idea2app/next-bootstrap-ts
9-
environment:
10-
- NODE_ENV=production
11-
- PORT=3000
12-
ports:
13-
- 3000:3000
7+
web-server:
8+
image: idea2app/web-server
149
networks:
1510
- idea2app
1611
healthcheck:
@@ -34,11 +29,11 @@ services:
3429

3530
caddy:
3631
depends_on:
37-
- next-bootstrap-ts
32+
- web-server
3833
image: caddy
3934
ports:
4035
- 80:80
4136
- 443:443
4237
networks:
4338
- idea2app
44-
command: caddy reverse-proxy --from your.domain.com --to next-bootstrap-ts:3000
39+
command: caddy reverse-proxy --from idea2app.cn --to web-server:3000

next.config.js renamed to next.config.mjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
const { NormalModuleReplacementPlugin } = require('webpack'),
2-
withLess = require('next-with-less'),
3-
setPWA = require('next-pwa');
1+
import webpack from 'webpack';
2+
import withLess from 'next-with-less';
3+
import setPWA from 'next-pwa';
44

55
const { NODE_ENV } = process.env,
66
withPWA = setPWA({
@@ -13,11 +13,11 @@ const { NODE_ENV } = process.env,
1313
/**
1414
* @type {import('next').NextConfig}
1515
*/
16-
module.exports = withPWA(
16+
export default withPWA(
1717
withLess({
1818
webpack: config => {
1919
config.plugins.push(
20-
new NormalModuleReplacementPlugin(/^node:/, resource => {
20+
new webpack.NormalModuleReplacementPlugin(/^node:/, resource => {
2121
resource.request = resource.request.replace(/^node:/, '');
2222
}),
2323
);

package.json

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
"file-type": "^18.7.0",
99
"idea-react": "^1.0.0-rc.30",
1010
"koajax": "^0.9.6",
11+
"less": "^4.2.0",
12+
"less-loader": "^11.1.3",
1113
"lodash": "^4.17.21",
1214
"mobx": "~6.10.2",
1315
"mobx-i18n": "^0.4.2",
@@ -16,30 +18,27 @@
1618
"mobx-restful": "^0.6.12",
1719
"mobx-restful-table": "^1.2.2",
1820
"next": "^14.0.3",
21+
"next-pwa": "~5.6.0",
1922
"next-ssr-middleware": "^0.6.1",
23+
"next-with-less": "^3.0.1",
2024
"react": "^18.2.0",
2125
"react-bootstrap": "^2.9.1",
2226
"react-dom": "^18.2.0",
2327
"web-utility": "^4.1.3",
2428
"webpack": "^5.89.0"
2529
},
2630
"devDependencies": {
27-
"@octokit/openapi-types": "^19.0.2",
31+
"@octokit/openapi-types": "^19.1.0",
2832
"@types/lodash": "^4.14.202",
29-
"@types/node": "^18.18.13",
30-
"@types/react": "^18.2.38",
33+
"@types/node": "^18.19.0",
34+
"@types/react": "^18.2.39",
3135
"eslint": "^8.54.0",
3236
"eslint-config-next": "^14.0.3",
3337
"eslint-config-prettier": "^9.0.0",
3438
"eslint-plugin-simple-import-sort": "^10.0.0",
3539
"husky": "^8.0.3",
36-
"less": "^4.2.0",
37-
"less-loader": "^11.1.3",
3840
"lint-staged": "^15.1.0",
39-
"next-pwa": "~5.6.0",
40-
"next-with-less": "^3.0.1",
4141
"prettier": "^3.1.0",
42-
"ts-node": "^10.9.1",
4342
"typescript": "~5.3.2"
4443
},
4544
"prettier": {
@@ -59,7 +58,7 @@
5958
"start": "next start",
6059
"lint": "next lint",
6160
"test": "lint-staged && npm run lint",
62-
"pack-image": "docker build -t idea2app/next-bootstrap-ts:latest .",
63-
"container": "docker rm -f next-bootstrap-ts && docker run --name next-bootstrap-ts -p 3000:3000 -d idea2app/next-bootstrap-ts:latest"
61+
"pack-image": "docker build -t idea2app/web-server .",
62+
"container": "docker rm -f web-server && docker run --name web-server -p 3000:3000 -d idea2app/web-server"
6463
}
6564
}

0 commit comments

Comments
 (0)