-
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.
feat: update prod docker compose impl
- Loading branch information
Showing
16 changed files
with
95 additions
and
100 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
node_modules | ||
dist | ||
*.md | ||
.git | ||
.gitignore | ||
.prettierrc | ||
.env |
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,38 @@ | ||
FROM node:20-slim AS base | ||
ENV PNPM_HOME="/pnpm" | ||
ENV PATH="$PNPM_HOME:$PATH" | ||
RUN corepack enable | ||
|
||
FROM base AS build | ||
WORKDIR /usr/src/app | ||
|
||
COPY pnpm-workspace.prod.yaml pnpm-workspace.yaml | ||
COPY pnpm-lock.yaml . | ||
|
||
COPY server/package.json server/package.json | ||
COPY web/package.json web/package.json | ||
|
||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile | ||
|
||
COPY . . | ||
COPY server/.env.docker server/.env | ||
COPY web/.env.docker web/.env | ||
|
||
RUN NODE_ENV=production pnpm run -r build | ||
|
||
RUN pnpm deploy --filter=server --prod /prod/server --ignore-scripts | ||
RUN mv ./web /prod/web | ||
|
||
FROM base AS app | ||
WORKDIR /prod/app | ||
|
||
COPY --from=build /prod/server . | ||
COPY --from=build /prod/web/dist ./web/dist | ||
|
||
RUN pnpm swag:gen | ||
|
||
ENV NODE_ENV production | ||
|
||
EXPOSE 5000 | ||
|
||
CMD [ "pnpm", "start" ] |
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
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
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 |
---|---|---|
|
@@ -10,8 +10,8 @@ | |
"prepare": "husky install", | ||
"commitlint": "commitlint --edit", | ||
"docker:up": "docker compose -f docker-compose.prod.yml up --build -d", | ||
"docker:db:migrate": "docker exec -it mchat-server pnpm migrate:run", | ||
"docker:db:seed": "docker exec -it mchat-server pnpm seed", | ||
"docker:db:migrate": "docker exec -it mchat-app pnpm migrate:run", | ||
"docker:db:seed": "docker exec -it mchat-app pnpm seed", | ||
"docker:down": "docker compose -f docker-compose.prod.yml down", | ||
"e2e:test": "pnpm --filter e2e test" | ||
}, | ||
|
@@ -34,5 +34,6 @@ | |
"workspaces": [ | ||
"client", | ||
"server" | ||
] | ||
], | ||
"packageManager": "[email protected]+sha512.38dc6fba8dba35b39340b9700112c2fe1e12f10b17134715a4aa98ccf7bb035e76fd981cf0bb384dfa98f8d6af5481c2bef2f4266a24bfa20c34eb7147ce0b5e" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,3 @@ | ||
packages: | ||
- 'web' | ||
- 'server' |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
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
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
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,3 +1,5 @@ | ||
import 'module-alias/register' | ||
|
||
import swaggerAutogen from 'swagger-autogen' | ||
|
||
const doc = { | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.