FROM ubuntu:22.04Base image
FROM alpine:3.18Minimal base image
FROM node:18-alpineNode.js on Alpine
RUN apt-get update && apt-get install -y curlInstall packages
WORKDIR /appSet working directory
COPY . .Copy files
COPY src/ /app/src/Copy with destination
ADD file.tar.gz /app/Add and extract
ENV NODE_ENV=productionSet environment variable
EXPOSE 8080Expose port
CMD ["node", "server.js"]Default command (exec form)
ENTRYPOINT ["node"]Entry point executable
VOLUME ["/data"]Create mount point
USER appuserSet user
ARG VERSION=1.0Build argument
LABEL version="1.0"Add metadata
HEALTHCHECK CMD curl -f http://localhost/Health check
SHELL ["/bin/bash", "-c"]Default shell
STOPSIGNAL SIGTERMStop signal
ONBUILD COPY . /appTrigger on next build
# CommentComment line
RUN npm installInstall dependencies
RUN npm run buildBuild application
COPY --from=builder /app/dist ./distMulti-stage copy
AS builderNamed build stage
ARG DEBIAN_FRONTEND=noninteractiveNon-interactive apt
RUN apt-get clean && rm -rf /var/lib/apt/lists/*Clean apt cache
ENV PATH="/app/bin:${PATH}"Update PATH