mirror of
https://github.com/goldbergyoni/nodebestpractices.git
synced 2025-10-28 11:35:59 +08:00
format the Chinese translation too
This commit is contained in:
@ -15,10 +15,11 @@ Docker イメージは単なるファイルの束ではなく、ビルド時に
|
|||||||
|
|
||||||
<summary><strong>Dockerfile</strong></summary>
|
<summary><strong>Dockerfile</strong></summary>
|
||||||
|
|
||||||
```
|
```dockerfile
|
||||||
# syntax = docker/dockerfile:1.0-experimental
|
# syntax = docker/dockerfile:1.0-experimental
|
||||||
|
|
||||||
FROM node:12-slim
|
FROM node:12-slim
|
||||||
|
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
COPY package.json package-lock.json ./
|
COPY package.json package-lock.json ./
|
||||||
RUN --mount=type=secret,id=npm,target=/root/.npmrc npm ci
|
RUN --mount=type=secret,id=npm,target=/root/.npmrc npm ci
|
||||||
@ -36,17 +37,21 @@ RUN --mount=type=secret,id=npm,target=/root/.npmrc npm ci
|
|||||||
|
|
||||||
<summary><strong>Dockerfile</strong></summary>
|
<summary><strong>Dockerfile</strong></summary>
|
||||||
|
|
||||||
```
|
```dockerfile
|
||||||
|
|
||||||
FROM node:12-slim AS build
|
FROM node:12-slim AS build
|
||||||
|
|
||||||
ARG NPM_TOKEN
|
ARG NPM_TOKEN
|
||||||
|
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
COPY . /dist
|
COPY . /dist
|
||||||
|
|
||||||
RUN echo "//registry.npmjs.org/:\_authToken=\$NPM_TOKEN" > .npmrc && \
|
RUN echo "//registry.npmjs.org/:\_authToken=\$NPM_TOKEN" > .npmrc && \
|
||||||
npm ci --production && \
|
npm ci --production && \
|
||||||
rm -f .npmrc
|
rm -f .npmrc
|
||||||
|
|
||||||
|
|
||||||
FROM build as prod
|
FROM build as prod
|
||||||
|
|
||||||
COPY --from=build /dist /dist
|
COPY --from=build /dist /dist
|
||||||
CMD ["node", "index.js"]
|
CMD ["node", "index.js"]
|
||||||
|
|
||||||
@ -63,10 +68,11 @@ CMD ["node","index.js"]
|
|||||||
|
|
||||||
<summary><strong>Dockerfile</strong></summary>
|
<summary><strong>Dockerfile</strong></summary>
|
||||||
|
|
||||||
```
|
```dockerfile
|
||||||
|
|
||||||
FROM node:12-slim
|
FROM node:12-slim
|
||||||
|
|
||||||
ARG NPM_TOKEN
|
ARG NPM_TOKEN
|
||||||
|
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
COPY . /dist
|
COPY . /dist
|
||||||
RUN echo "//registry.npmjs.org/:\_authToken=\$NPM_TOKEN" > .npmrc && \
|
RUN echo "//registry.npmjs.org/:\_authToken=\$NPM_TOKEN" > .npmrc && \
|
||||||
|
|||||||
Reference in New Issue
Block a user