Skip to content

Commit d228631

Browse files
committed
chore(@jcoreio/toolchain-aws-ecr-publish): simplify init Dockerfile
1 parent c3a8251 commit d228631

1 file changed

Lines changed: 3 additions & 22 deletions

File tree

packages/aws-ecr-publish/plugins/getConfigFiles.cjs

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,39 +28,20 @@ module.exports = [
2828
),
2929
Dockerfile: dedent`
3030
ARG NODE_VERSION=24
31-
FROM node:\${NODE_VERSION} AS build
32-
33-
WORKDIR /usr/app
34-
35-
ARG NPM_TOKEN
36-
37-
# Project uses private NPM modules. Pass in NPM token externally.
38-
# Tell NPM to use the token from the environment variable
39-
RUN npm config set --location global \
40-
"//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" \
41-
"registry=https://registry.npmjs.org/"
42-
43-
ARG NODE_ENV=production
44-
ENV NODE_ENV=$NODE_ENV
45-
COPY package.json pnpm-lock.yaml /usr/app/
46-
RUN corepack enable && pnpm i --production --frozen-lockfile
47-
48-
# Build the final image
4931
FROM node:\${NODE_VERSION}
5032
5133
WORKDIR /usr/app
5234
5335
ARG NODE_ENV=production
5436
ENV NODE_ENV=$NODE_ENV
37+
COPY package.json pnpm-lock.yaml /usr/app/
38+
RUN --mount=type=secret,id=npmrc,target=/usr/app/.npmrc \
39+
corepack enable && pnpm i --production --frozen-lockfile
5540
5641
EXPOSE 80
5742
58-
COPY --from=build /usr/app/node_modules /usr/app/node_modules/
59-
COPY --from=build /usr/app/package.json /usr/app/pnpm-lock.yaml /usr/app/
6043
COPY src/ /usr/app/src/
6144
62-
ENV PORT=80
63-
6445
RUN ["node", "src/index.ts"]
6546
`,
6647
}

0 commit comments

Comments
 (0)