Skip to content

Commit

Permalink
Feat dockerfile (#499)
Browse files Browse the repository at this point in the history
* feat: Dockerfile
  • Loading branch information
QizhengMo authored Oct 17, 2023
1 parent cd8d374 commit ebc13e4
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 65 deletions.
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM node:20-slim AS pnpm-base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable

FROM pnpm-base AS base
COPY . /app
WORKDIR /app

FROM base AS prod-deps
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install

FROM base AS build
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install
RUN pnpm run build

FROM pnpm-base AS arex
# runtime server
COPY --from=build /app/arex-server/ /app/

# frontend build product
COPY --from=build /app/packages/arex/dist /app/dist

WORKDIR /app
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install
EXPOSE 8080
CMD [ "node", "./server.js",">","./logs/app.log","2>", "./logs/error.log"]
16 changes: 16 additions & 0 deletions arex-server/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "arex-server",
"private": true,
"version": "0.6.0",
"type": "module",
"scripts": {
"start": "node server.js"
},
"dependencies": {
"express": "^4.18.2",
"http-proxy-middleware": "^2.0.6",
"connect-history-api-fallback": "^2.0.0"
},
"devDependencies": {
}
}
File renamed without changes.
3 changes: 0 additions & 3 deletions packages/arex/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@
"@types/react-color": "^3.0.6",
"@types/react-dom": "^18.2.0",
"@vitejs/plugin-react-swc": "^3.3.0",
"connect-history-api-fallback": "^2.0.0",
"express": "^4.18.2",
"http-proxy-middleware": "^2.0.6",
"typescript": "^5.0.2",
"unplugin-icons": "^0.16.3",
"vite": "^4.2.0",
Expand Down
Loading

0 comments on commit ebc13e4

Please sign in to comment.