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
015650ec
Commit
015650ec
authored
Jan 3, 2024
by
Dmitriy Safronov
Browse files
Options
Downloads
Patches
Plain Diff
Update Dockerfile
parent
033c07c0
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Dockerfile
+7
-2
7 additions, 2 deletions
Dockerfile
with
7 additions
and
2 deletions
Dockerfile
+
7
−
2
View file @
015650ec
# VERSIONS
ARG
NODE_VERSION=20.10.0
ARG
NPM_VERSION=10.2.5
# --------------> The build image
# --------------> The build image
FROM
node:
20.10.0
AS
build
FROM
node:
$NODE_VERSION
AS
build
RUN
apt-get update
&&
apt-get
install
-y
--no-install-recommends
dumb-init
RUN
apt-get update
&&
apt-get
install
-y
--no-install-recommends
dumb-init
ARG
NPM_TOKEN
ARG
NPM_TOKEN
WORKDIR
/usr/src/app
WORKDIR
/usr/src/app
COPY
package*.json /usr/src/app/
COPY
package*.json /usr/src/app/
RUN
echo
"//registry.npmjs.org/:_authToken=
$NPM_TOKEN
"
>
.npmrc
&&
\
RUN
echo
"//registry.npmjs.org/:_authToken=
$NPM_TOKEN
"
>
.npmrc
&&
\
npm
install
-g
npm@
$NPM_VERSION
&&
\
npm ci
--omit
=
dev
&&
\
npm ci
--omit
=
dev
&&
\
rm
-f
.npmrc
rm
-f
.npmrc
# --------------> The production image
# --------------> The production image
FROM
node:
20.10.0
-slim
FROM
node:
$NODE_VERSION
-slim
ENV
NODE_ENV production
ENV
NODE_ENV production
COPY
--from=build /usr/bin/dumb-init /usr/bin/dumb-init
COPY
--from=build /usr/bin/dumb-init /usr/bin/dumb-init
USER
node
USER
node
...
...
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