Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Dummy Backend
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Examples
Javascript
Dummy Backend
Commits
50665724
Commit
50665724
authored
Jan 3, 2024
by
Dmitriy Safronov
Browse files
Options
Downloads
Patches
Plain Diff
update dockerfile
parent
015650ec
No related branches found
No related tags found
No related merge requests found
Pipeline
#35123
passed
Feb 20, 2024
Stage: build
Changes
1
Pipelines
3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Dockerfile
+8
-7
8 additions, 7 deletions
Dockerfile
with
8 additions
and
7 deletions
Dockerfile
+
8
−
7
View file @
50665724
...
...
@@ -2,11 +2,12 @@
ARG
NODE_VERSION=20.10.0
ARG
NPM_VERSION=10.2.5
# --------------> The build image
FROM
node:$NODE_VERSION
AS
build
# --------------> The builder image
FROM
node:$NODE_VERSION
AS
builder
ENV
NODE_ENV production
WORKDIR
/usr/src/app
RUN
apt-get update
&&
apt-get
install
-y
--no-install-recommends
dumb-init
ARG
NPM_TOKEN
WORKDIR
/usr/src/app
COPY
package*.json /usr/src/app/
RUN
echo
"//registry.npmjs.org/:_authToken=
$NPM_TOKEN
"
>
.npmrc
&&
\
npm
install
-g
npm@
$NPM_VERSION
&&
\
...
...
@@ -14,11 +15,11 @@ RUN echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc && \
rm
-f
.npmrc
# --------------> The production image
FROM
node:$NODE_VERSION-slim
FROM
node:$NODE_VERSION-slim
AS
production
ENV
NODE_ENV production
COPY
--from=build /usr/bin/dumb-init /usr/bin/dumb-init
USER
node
WORKDIR
/usr/src/app
COPY
--chown=node:node --from=build /usr/src/app/node_modules /usr/src/app/node_modules
COPY
--from=builder /usr/bin/dumb-init /usr/bin/dumb-init
COPY
--chown=node:node --from=builder /usr/src/app/node_modules /usr/src/app/node_modules
COPY
--chown=node:node . /usr/src/app
USER
node
CMD
["dumb-init", "node", "index.js"]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment