我的 Dockerfile 执行RUN npm run build命令。当我docker build在 t2.micro EC2 实例上执行命令时,实例冻结并且不响应(我什至无法使用 ssh 连接)。当我监控CPU使用率时,我可以看到CPU使用率达到了最高水平。因此,我尝试使用--max_semi_space_size=1和--max_old_space_size=198参数来限制内存使用,但它不起作用。
如果我可以为 docker build 命令设置 CPU 使用限制,我认为它可能会起作用。有人能帮我吗?
我知道,如果我增加 EC2 实例的 vCPU 数量,那么我可以毫无问题地构建我的应用程序,但由于它是一个演示项目,我尝试将其部署在免费层上。
Dockerfile:
FROM node:16-alpine
COPY . .
# Install dependencies
RUN node \
--max_semi_space_size=1 \
--max_old_space_size=198 \
$(which npm) ci
# Build the app
RUN node \
--max_semi_space_size=1 \
--max_old_space_size=198 \
$(which npm) run build
EXPOSE 3000
# Start the app
CMD [ "npx", "serve", "build" ]
Run Code Online (Sandbox Code Playgroud) SS、SP、BP的初始值是多少?它们是否为空 (0x0) 或者例如 SP 是否立即设置为 0xFFFE?
当我们编写汇编代码而不使用 pop 和 push 语句时,堆栈指针是否设置为一个值?
Spring Boot 自动配置最近在 2.7 版本中进行了更改,并且大多数设置在 3.0 版本中已弃用(您可以在此处找到详细信息)。此外,他们还为自动配置类引入了新的注释,即@AutoConfiguration. 我无法理解下面所述的注释的默认设置:
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Configuration(proxyBeanMethods = false)
@AutoConfigureBefore
@AutoConfigureAfter
public @interface AutoConfiguration {
}
Run Code Online (Sandbox Code Playgroud)
为什么他们强制用户继承proxyBeanMethods = false,@AutoConfigureBefore和@AutoConfigureAfter?
spring spring-boot spring-boot-configuration spring-autoconfiguration
assembly ×1
boot ×1
cpu-usage ×1
docker ×1
docker-build ×1
node.js ×1
npm-run ×1
spring ×1
spring-boot ×1
x86-16 ×1