5 Commits

Author SHA1 Message Date
Baohua Yang
d4c6e590c6 Merge pull request #497 from npmmirror/master
Update https://registry.npm.taobao.org to https://registry.npmmirror.com
2022-02-16 11:50:56 -08:00
NPM Mirror Bot
1e415ac76c update https://registry.npm.taobao.org to https://registry.npmmirror.com 2022-02-11 22:09:47 -05:00
NPM Mirror Bot
664ac88c85 update https://registry.npm.taobao.org to https://registry.npmmirror.com 2022-02-11 13:56:55 +00:00
Kang Huaishuai
734079661d Merge pull request #496 from smartlixx/patch-1
Update best_practices.md
2022-01-04 11:01:18 +08:00
Xianxiang Li
1ed8c2c81f Update best_practices.md
Fix a typo
2022-01-04 10:41:51 +08:00
4 changed files with 5 additions and 5 deletions

View File

@@ -329,7 +329,7 @@ $ docker run --rm -it postgres bash
如果某个服务不需要特权执行建议使用 `USER` 指令切换到非 root 用户先在 `Dockerfile` 中使用类似 `RUN groupadd -r postgres && useradd -r -g postgres postgres` 的指令创建用户和用户组 如果某个服务不需要特权执行建议使用 `USER` 指令切换到非 root 用户先在 `Dockerfile` 中使用类似 `RUN groupadd -r postgres && useradd -r -g postgres postgres` 的指令创建用户和用户组
>注意在镜像中用户和用户组每次被分配的 UID/GID 都是不确定的下次重新构建镜像时被分配到的 UID/GID 可能会不一样如果要依赖确定的 UID/GID你应该显的指定一个 UID/GID >注意在镜像中用户和用户组每次被分配的 UID/GID 都是不确定的下次重新构建镜像时被分配到的 UID/GID 可能会不一样如果要依赖确定的 UID/GID你应该显的指定一个 UID/GID
你应该避免使用 `sudo`因为它不可预期的 TTY 和信号转发行为可能造成的问题比它能解决的问题还多如果你真的需要和 `sudo` 类似的功能例如 root 权限初始化某个守护进程以非 root 权限执行它你可以使用 [gosu](https://github.com/tianon/gosu)。 你应该避免使用 `sudo`因为它不可预期的 TTY 和信号转发行为可能造成的问题比它能解决的问题还多如果你真的需要和 `sudo` 类似的功能例如 root 权限初始化某个守护进程以非 root 权限执行它你可以使用 [gosu](https://github.com/tianon/gosu)。

View File

@@ -4,7 +4,7 @@ WORKDIR /app
COPY package.json /app/ COPY package.json /app/
RUN npm i --registry=https://registry.npm.taobao.org \ RUN npm i --registry=https://registry.npmmirror.com \
&& rm -rf ~/.npm && rm -rf ~/.npm
COPY src /app/src COPY src /app/src

View File

@@ -8,7 +8,7 @@ COPY package.json /app/
RUN --mount=type=cache,target=/app/node_modules,id=my_app_npm_module,sharing=locked \ RUN --mount=type=cache,target=/app/node_modules,id=my_app_npm_module,sharing=locked \
--mount=type=cache,target=/root/.npm,id=npm_cache \ --mount=type=cache,target=/root/.npm,id=npm_cache \
npm i --registry=https://registry.npm.taobao.org npm i --registry=https://registry.npmmirror.com
COPY src /app/src COPY src /app/src

View File

@@ -61,7 +61,7 @@ FROM node:alpine as frontend
COPY package.json /app/ COPY package.json /app/
RUN set -x ; cd /app \ RUN set -x ; cd /app \
&& npm install --registry=https://registry.npm.taobao.org && npm install --registry=https://registry.npmmirror.com
COPY webpack.mix.js webpack.config.js tailwind.config.js /app/ COPY webpack.mix.js webpack.config.js tailwind.config.js /app/
COPY resources/ /app/resources/ COPY resources/ /app/resources/
@@ -179,7 +179,7 @@ FROM node:alpine as frontend
COPY package.json /app/ COPY package.json /app/
RUN set -x ; cd /app \ RUN set -x ; cd /app \
&& npm install --registry=https://registry.npm.taobao.org && npm install --registry=https://registry.npmmirror.com
COPY webpack.mix.js webpack.config.js tailwind.config.js /app/ COPY webpack.mix.js webpack.config.js tailwind.config.js /app/
COPY resources/ /app/resources/ COPY resources/ /app/resources/