Skip to content

Commit

Permalink
fix: 修复Docker构建OOM异常,使用增加OOM限制的node:20.17.0-alpine基础镜像
Browse files Browse the repository at this point in the history
  • Loading branch information
mmdapl committed Nov 1, 2024
1 parent 7b7d698 commit d78e081
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
13 changes: 4 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ FROM registry.cn-hangzhou.aliyuncs.com/142vip/node:20.17.0-alpine AS build_base
# 是否配置代理
ARG NEED_PROXY=false

## 设置环境变量,支持容器构建时使用layer缓存,参考:https://pnpm.io/zh/docker
# 设置环境变量,支持容器构建时使用layer缓存,参考:https://pnpm.io/zh/docker
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"

Expand All @@ -21,10 +21,7 @@ ENV PATH="$PNPM_HOME:$PATH"
WORKDIR /apps
COPY . .

## 安装git,博客编译需要使用git信息
RUN apk add --no-cache git --repository http://mirrors.aliyun.com/alpine/v3.14/main/

## 基于容器自动构建
# 基于容器自动构建
RUN --mount=type=cache,id=pnpm,target=/pnpm/store sh ./scripts/ci && \
if [ "$NEED_PROXY" = "false" ]; \
then \
Expand All @@ -33,11 +30,9 @@ RUN --mount=type=cache,id=pnpm,target=/pnpm/store sh ./scripts/ci && \
pnpm build:proxy; \
fi;

FROM registry.cn-hangzhou.aliyuncs.com/142vip/nginx:1.27.0-alpine

FROM registry.cn-hangzhou.aliyuncs.com/142vip/nginx:1.23.0-alpine


## 自定义镜像的Label信息
# 自定义镜像的Label信息
ARG APP_NAME
ARG APP_VERSION
ARG APP_DESCRIPTION
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
version: '2'
services:
JavaScriptCollection:
image: registry.cn-hangzhou.aliyuncs.com/142vip/docs:JavaScriptCollection-0.0.1
image: registry.cn-hangzhou.aliyuncs.com/142vip/docs:JavaScriptCollection-0.0.2-alpha.21
container_name: JavaScriptCollection
hostname: JavaScriptCollection
ports:
Expand Down

0 comments on commit d78e081

Please sign in to comment.