Skip to content

joshkapple/functions-framework-nestjs-experiment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

This repo is a test for a set of GCP Functions Framework functions implemented with nestjs.com.
The project relies on the functions-framework to provide a common context for execution whether that is local or in a GCP product.

Based on this blog post: https://fireship.io/snippets/setup-nestjs-on-cloud-functions/

Project structure

./README.md                         # This readme file
./backend                           # The backend application composed of functions implemented with nestjs
./backend/src/                          # Typescript source files
./docker                            # Docker build contexts

Prerequisites

Recommended installs

You may also want to install

  • Node Version Manager NVM (an .nvmrc file is included in the project)
  • Docker
  • Buildpack

Getting started

Docker

Build

  • cd into the ./ root folder. (This gives Docker engine the context of the root folder)
  • docker build --progress=plain --no-cache=true -t backend:test -f ./docker/backend-build/Dockerfile .
    • where backend and test of backend:test are the image name and tag you wish to use
  • docker image ls should show your new image

Run

  • docker run -p 8080:8080 backend:test

Buildpack

As an alternative to the included Dockerfile, buildpack can also be used for producing a docker image.
./package.json and ./backend/package.json support building with Buildpack too.
Install build pack via the link above then run the builder from the root of the project

  • pack build pack-backend --builder gcr.io/buildpacks/builder

After this step a docker image called pack-backend should be available via docker image ls

GCP

Pushing image to GCP

You can push an image from your local Docker image repo to GCP. See (https://cloud.google.com/artifact-registry/docs/docker/quickstart)[https://cloud.google.com/artifact-registry/docs/docker/quickstart].

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published