Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Rclone | 40,528 | 35 | 4 hours ago | 263 | July 17, 2023 | 912 | mit | Go | ||
"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Yandex Files | ||||||||||
Analytics | 16,185 | 2 hours ago | 33 | agpl-3.0 | Elixir | |||||
Simple, open source, lightweight (< 1 KB) and privacy-friendly web analytics alternative to Google Analytics. | ||||||||||
Awesome Kubernetes | 14,249 | 14 days ago | 7 | other | Shell | |||||
A curated list for awesome kubernetes sources :ship::tada: | ||||||||||
Xg2xg | 13,360 | 13 hours ago | 49 | |||||||
by ex-googlers, for ex-googlers - a lookup table of similar tech & services | ||||||||||
Functions Samples | 11,836 | 5 hours ago | 153 | apache-2.0 | JavaScript | |||||
Collection of sample apps showcasing popular use cases using Cloud Functions for Firebase | ||||||||||
Infracost | 9,601 | 2 hours ago | 144 | July 21, 2023 | 157 | apache-2.0 | Go | |||
Cloud cost estimates for Terraform in pull requests💰📉 Love your cloud bill! | ||||||||||
Training Data Analyst | 7,018 | 7 days ago | 394 | apache-2.0 | Jupyter Notebook | |||||
Labs and demos for courses for GCP Training (http://cloud.google.com/training). | ||||||||||
Python Docs Samples | 6,567 | 4 hours ago | 2 | May 24, 2021 | 132 | apache-2.0 | Jupyter Notebook | |||
Code samples used on cloud.google.com | ||||||||||
Google Cloud Python | 4,345 | 123 | 2 days ago | 38 | August 03, 2023 | 130 | apache-2.0 | Python | ||
Google Cloud Client Library for Python | ||||||||||
Apps Script Samples | 4,054 | 6 days ago | 47 | apache-2.0 | JavaScript | |||||
Apps Script samples for Google Workspace products. |
This repository contains a set of builders and buildpacks designed to run on Google Cloud's container platforms: Cloud Run, GKE, Anthos, and Compute Engine running Container-Optimized OS. They are also used as the build system for App Engine and Cloud Functions. They are 100% compatible with CNCF Buildpacks.
Clone the sample apps:
git clone https://github.com/GoogleCloudPlatform/buildpack-samples.git
cd buildpack-samples
Pick a sample and build it, for instance with sample-go
:
cd sample-go
pack build --builder gcr.io/buildpacks/builder:v1 sample-go
Run it with docker, like:
docker run --rm -p 8080:8080 sample-go
See the Usage section for more details.
To read more, see Buildpack project documentation.
This is a general purpose builder that creates container images designed to run on most platforms (e.g. Kubernetes / Anthos, Knative / Cloud Run, Container OS, etc), and should be used by the majority of users. The builder attempts to autodetect the language of your source code, and can also build functions compatible with the Google Cloud Function Framework by setting the GOOGLE_FUNCTION_TARGET env var.
The generic builder is hosted at gcr.io/buildpacks/builder:v1
.
Supported languages include:
Runtime | App Support | Function Support |
---|---|---|
Go 1.10 + | ✓ | ✓ |
Node.js 10 + | ✓ | ✓ |
Python 3.7 + | ✓ | ✓ |
Java 8, 11 | ✓ | ✓ (11 only) |
.NET Core 3.1 + | ✓ | ✓ |
These builders create container images designed to run on Google Cloud's App Engine and Functions services. Most of the buildpacks are identical to those in the generic builder.
Compared to the generic builder, there are two primary differences. First, there are additional buildpacks which add transformations specific to each service. Second, in order to optimize execution speed, each language has a separate builder.
The Google Cloud Buildpacks project provides builder images suitable for use with pack, kpack, tekton, skaffold, and other tools that support the Buildpacks v3 specification.
The following command invokes pack to
apply the general builder to build the application in the current directory, and then
containerizes the result into a local container image named <app-name>
.
pack build <app-name> --builder gcr.io/buildpacks/builder:v1
The application you built can then be executed locally:
docker run --rm -p 8080:8080 <app-name>
You can set Cloud Buildpacks as your default:
pack set-default-builder gcr.io/buildpacks/builder:v1
And you can publish the built image to the cloud directly with pack:
pack build --publish gcr.io/YOUR_PROJECT_ID/APP_NAME
The same commands as above can be used to build a function image. The following command builds
a function called myFunction
and produces a local image named <fn-name>
.
pack build <fn-name> --builder gcr.io/buildpacks/builder:v1 --env GOOGLE_FUNCTION_TARGET=myFunction
If your application requires additional system packages to be installed and available when it runs, you can accomplish this by customizing the run container image.
cat > run.Dockerfile << EOF
FROM gcr.io/buildpacks/gcp/run:v1
USER root
RUN apt-get update && apt-get install -y --no-install-recommends \
imagemagick && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
USER cnb
EOF
docker build -t my-run-image -f run.Dockerfile .
To use the custom run image with pack:
pack build my-app --builder gcr.io/buildpacks/builder:v1 --run-image my-run-image
If you require certain packages for building your application, create a custom builder image based on the base builder:
cat > builder.Dockerfile << EOF
FROM gcr.io/buildpacks/builder:v1
USER root
RUN apt-get update && apt-get install -y --no-install-recommends \
subversion && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
USER cnb
EOF
docker build -t my-builder-image -f builder.Dockerfile .
To use the custom builder with pack:
pack build my-app --builder my-builder-image
Google Cloud Buildpacks support configuration using a set of environment variables that are supported across runtimes.
GOOGLE_ENTRYPOINT
gunicorn -p :8080 main:app
for Python. java -jar target/myjar.jar
for Java.GOOGLE_RUNTIME
nodejs
will cause the nodejs/runtime buildpack to opt-in.GOOGLE_RUNTIME_VERSION
13.7.0
for Node.js, 1.14.1
for Go, 8
for Java, 3.1.301
for .NET.GOOGLE_BUILDABLE
./maindir
for Go will build the package rooted at maindir.GOOGLE_BUILD_ARGS
-Pprod
for a Java will run mvn clean package ... -Pprod
.GOOGLE_DEVMODE
skaffold dev
.true
, True
, 1
will enable development mode.GOOGLE_CLEAR_SOURCE
true
, True
, 1
will clear the source.Certain buildpacks support other environment variables:
For use with source code built around the Google Cloud Functions Framework. See the contract for more information about the configuration options.
GOOGLE_FUNCTION_TARGET
myFunction
will cause the Functions Framework to invoke the function of the same name.GOOGLE_FUNCTION_SIGNATURE_TYPE
http
or event
.GOOGLE_FUNCTION_SOURCE
function.py
for Python.GOOGLE_GOGCFLAGS
go build
and go run
as -gcflags value
with no interpretation.all=-N -l
enables race condition analysis and changes how source filepaths are recorded in the binary.GOOGLE_GOLDFLAGS
go build
and go run
as -ldflags value
with no interpretation.-s -w
is used to strip and reduce binary size.Buildpacks support language-idiomatic configuration through environment
variables. These environment variables should be specified without a
GOOGLE_
prefix.
Go
GO<key>
, see documentation.
GOFLAGS=-flag=value
passes -flag=value
to go
commands.Java
MAVEN_OPTS
, see documentation.
MAVEN_OPTS=-Xms256m -Xmx512m
passes these flags to the JVM running Maven.MAVEN_OPTS=--add-opens java.base/java.lang=ALL-UNNAMED
to suppress "illegal reflective access" warnings from Maven.GRADLE_OPTS
, see documentation.
GRADLE_OPTS=-Xms256m -Xmx512m
passes these flags to the JVM running Gradle.Mirror URLs can be found here
For Maven: Using Mirrors for Repositories
Create a copy of the settings.xml from the default location of ~/.m2/settings.xml to inside your application source directory and specify GOOGLE_BUILD_ARGS=--settings <path/to/settings>
. (Note <path/to/settings> is relative to the source directory.)
Example settings.xml
<settings>
<mirrors>
<mirror>
<id>google-maven-central</id>
<name>GCS Maven Central mirror</name>
<url>https://maven-central.storage-download.googleapis.com/maven2/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
</settings>
For Gradle: Declaring Repositories
Example build.gradle
entry
repositories {
maven {
url "https://maven-central.storage-download.googleapis.com/maven2/"
}
}
Node.js
NPM_CONFIG_<key>
, see documentation.
NPM_CONFIG_FLAG=value
passes -flag=value
to npm
commands.PHP
COMPOSER_<key>
, see documentation.
COMPOSER_PROCESS_TIMEOUT=60
sets the timeout for composer
commands.Python
PIP_<key>
, see documentation.
PIP_DEFAULT_TIMEOUT=60
sets --default-timeout=60
for pip
commands.Ruby
BUNDLE_<key>
, see documentation.
BUNDLE_TIMEOUT=60
sets --timeout=60
for bundle
commands.node_modules
directory is deleted and dependencies reinstalled using package.json and a lockfile if present.Private dependencies must be vendored. The build does not have access to private repository credentials and cannot pull dependencies at build time. Please see the App Engine instructions
(generic builder only) Applications without a go.mod cannot have sub-packages.
Go 1.14 triggers a kernel bug in some versions of the Linux kernel (versions other than 5.3.15+, 5.4.2+, or 5.5+). If using an affected version, please set the following in your /etc/docker/daemon.json:
"default-ulimits": {
"memlock": {
"Name": "memlock",
"Soft": -1,
"Hard": -1
}
},
The buildpack builder can be invoked as a step of a Google Cloud Build process, for instance by using the pack builder image provided by the Skaffold project:
steps:
- name: 'gcr.io/k8s-skaffold/pack'
entrypoint: 'pack'
args: ['build', '--builder=gcr.io/buildpacks/builder', '--publish', 'gcr.io/$PROJECT_ID/sample-go:$COMMIT_SHA']
There is also alpha support for invoking this builder directly using gcloud
:
gcloud alpha builds submit --pack image=gcr.io/my-project/imageg
This command will send the local source directory to Cloud Build, invoke this buildpack builder on it, and publish the resulting image to Google Container Registry.
Google Cloud Buildpacks are only officially supported when used with Google Cloud products. Customers of Google Cloud can use standard support channels for help using buildpacks with Google Cloud Products.
We welcome contributions! Here's how you can contribute:
See LICENSE.