Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
translation-server
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qinmingyuan
translation-server
Commits
4be5d60a
You need to sign in or sign up before continuing.
Commit
4be5d60a
authored
Jan 09, 2025
by
mingyard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:dockerfile
parent
18c4bf84
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
0 deletions
+48
-0
Dockerfile
Dockerfile
+48
-0
No files found.
Dockerfile
0 → 100644
View file @
4be5d60a
# 使用官方 Node.js 镜像作为基础镜像
FROM
node:20-alpine as build-stage
# 设置工作目录
WORKDIR
/code
# 复制 package.json 和 yarn.lock
COPY
package.json ./
COPY
yarn.lock ./
# 安装依赖
RUN
yarn
install
--production
--ignore-optional
# 复制项目文件
COPY
. .
# 构建项目
RUN
yarn build
# 使用更小的 Node.js 镜像作为运行时镜像
FROM
node:20-slim as app-stage
# 设置环境变量
ENV
NODE_ENV=prod
# 设置工作目录
WORKDIR
/usr/src/code
# 创建配置目录
RUN
mkdir
/etc/work-server
# 复制构建结果和依赖
COPY
--from=build-stage /code/node_modules ./node_modules
COPY
--from=build-stage /code/dist ./
COPY
--from=build-stage /code/package.json ./
COPY
--from=build-stage /code/version.txt ./version.txt
# 暴露应用运行的端口
EXPOSE
3000
# 设置 Node.js 内存限制
ENV
NODE_OPTIONS=--max_old_space_size=4096
# 设置时区
ENV
TZ=Asia/Shanghai
# 启动命令
CMD
[ "yarn", "start" ]
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment