Skip to content

Commit

Permalink
feat: initial docker config
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin3go committed Jan 31, 2024
1 parent d1d5eec commit f0dccae
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 忽略 node_modules 目录
node_modules

# 忽略 .nuxt 目录
.nuxt

# 忽略日志文件
*.log

# 忽略操作系统生成的文件
.DS_Store
Thumbs.db

# 忽略编辑器生成的文件
.vscode
.idea
*.swp
*.swo

# 忽略 git 相关文件
.git
.gitignore

# 忽略测试和 CI 相关文件
tests/
.travis.yml
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 设置基础镜像
ARG NODE_VERSION=18.14.2
FROM node:${NODE_VERSION}-slim as base
ARG PORT=3000
ENV NODE_ENV=production
WORKDIR /src

# 构建阶段
FROM base as build
COPY --link package.json pnpm-lock.yaml ./
RUN npm install -g pnpm
RUN pnpm install --production=false
COPY --link . .
RUN pnpm run build
# RUN pnpm prune

# 运行阶段
FROM base
ENV PORT=$PORT
COPY --from=build /src/.output /src/.output
CMD ["node", ".output/server/index.mjs"]

0 comments on commit f0dccae

Please sign in to comment.