Skip to content

Example of Bazel build config for NestJS app

Notifications You must be signed in to change notification settings

siberex/bazel-nestjs-starter

Repository files navigation

Bazel at Scalio

Bazel Nest Starter

A starter app written in Typescript for NestJS -- built using Bazel

 

Overview

This project was created by invoking the default Nest app scaffold via the Nest CLI, and then the addition of simple BUILD.bazel and WORKSPACE files, making use of rules_nodejs.

To create this from scratch in a new project, run the following:

nest new AppName
yarn create @bazel APP_NAME --packageManager=yarn --typescript

and now add the files WORKSPACE and src/BUILD.bazel to your new directory root and src folders, respectively.

Build and run

With Bazel installed:

bazel run //src:server

Without Bazel installed:

yarn install -D
yarn bazel:run

Docker

Build Docker image:

bazel build --platforms=@build_bazel_rules_nodejs//toolchains/node:linux_amd64 //src:docker

Push image to the registry (currently set to gcr.io):

bazel run --define push_tag=${IMAGE_TAG} --define push_repository=${REPOSITORY} //src:push_container

Credits

Created by @siberex @ Scalio

About us