Dockerfile nestjs yarn




    The code starts an app on a node instance running Alpine 3.13 with a production environment set. First, it installs git, openssh, and npm. Next, it copies the app's package.json, yarn.lock, and ./ files to the root of the instance and sets the environment variables NODE_ENV and WORKDIR toProduction. Finally, it builds the app using yarn.

    FROM node:14-alpine3.13
    WORKDIR /app
    ENV NODE_ENV=production
    RUN apk add --no-cache git openssh
    RUN npm install -g @nestjs/cli
    COPY ["package.json", "yarn.lock", "./"]
    RUN yarn install --frozen-lockfile
    COPY . .
    RUN cp .env.production .env
    RUN yarn build
    EXPOSE 3000
    CMD ["yarn", "start:prod"]
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    • Security
    • Privacy Policy
    • Code Privacy
    • Terms of Service
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.