Simplify Dockerfile
This commit is contained in:
parent
e1d1df076e
commit
569559a8fd
18
Dockerfile
18
Dockerfile
|
@ -1,26 +1,22 @@
|
|||
|
||||
ARG NODE_VERSION=20.0.0
|
||||
|
||||
FROM node:${NODE_VERSION}-alpine
|
||||
FROM node:20-alpine
|
||||
|
||||
ENV NODE_ENV production
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
|
||||
RUN --mount=type=bind,source=package.json,target=package.json \
|
||||
--mount=type=bind,source=package-lock.json,target=package-lock.json \
|
||||
--mount=type=cache,target=/root/.npm
|
||||
|
||||
# Run the application as a root user.
|
||||
USER root
|
||||
# Install dependencies
|
||||
COPY package.json package-lock.json* ./
|
||||
RUN npm ci --omit=dev
|
||||
|
||||
# Copy the rest of the source files into the image.
|
||||
COPY . .
|
||||
|
||||
# Run the application as a root user.
|
||||
USER root
|
||||
|
||||
# Expose the port that the application listens on.
|
||||
EXPOSE 8000
|
||||
|
||||
# Run the application.
|
||||
CMD node app.js
|
||||
|
||||
|
|
Loading…
Reference in New Issue