Skip to content

Commit

Permalink
feat: dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
GaoNeng-wWw committed Nov 20, 2023
1 parent 43d2ae1 commit 3c1233e
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
.next
out
*.md
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NEXT_PUBLIC_API_SERVER="http://127.0.0.1:8102"
17 changes: 17 additions & 0 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM node:21-alpine3.18 as builder

WORKDIR /usr/builder

ENV NEXT_PUBLIC_API_SERVER="http://127.0.0.1:8102"

ADD . .

RUN npm install -g pnpm && \
pnpm install && \
pnpm build

FROM nginx

COPY --from=builder /usr/builder/out /usr/share/nginx/html

EXPOSE 80
2 changes: 1 addition & 1 deletion interface/api.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const SERVER_URL = "http://127.0.0.1:8102";
export const SERVER_URL = process.env.NEXT_PUBLIC_API_SERVER;


3 changes: 3 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ const nextConfig = {
}); // 针对 SVG 的处理规则
return config;
},
compiler:{
removeConsole: process.env.NODE_ENV === 'production',
}
}

module.exports = nextConfig

0 comments on commit 3c1233e

Please sign in to comment.