On this page

Build Configuration

When you deploy from a GitHub repository, Guara Cloud needs to build a container image of your application. There are two available build methods: Dockerfile and Buildpack.

Build methods

Dockerfile

With this method, you provide a Dockerfile in your repository. You have full control over the build environment: base operating system, dependencies, installation commands, and runtime configuration.

FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
EXPOSE 3000
CMD ["node", "server.js"]

Buildpack

With Buildpack, you do not need a Dockerfile. Guara Cloud automatically detects your application’s language and framework and builds the image for you. Buildpacks support the most common languages and frameworks, including Node.js, Python, Go, Java, and Ruby.

How the method is detected

Guara Cloud automatically detects which method to use:

SituationMethod used
A Dockerfile exists in the root directoryDockerfile
No Dockerfile in the root directoryBuildpack

For monorepos, detection considers the root directory configured for the service. If you set /apps/api as the root directory, Guara Cloud looks for apps/api/Dockerfile.

Monorepo

In monorepo repositories, the build uses only the root directory configured for the service. For example, if the root directory is /apps/api, Guara Cloud:

  • Looks for the Dockerfile at apps/api/Dockerfile
  • Sets the build context to the apps/api/ directory
  • Ignores files outside that directory for build purposes

This ensures that each service in a monorepo has independent and efficient builds.

Build caching

Guara Cloud uses layer caching to speed up subsequent builds. When you deploy again, only the layers that changed are rebuilt. This significantly reduces build time in most cases.

To take full advantage of caching with Dockerfile, order your instructions from most stable to least stable:

# Stable layers (change rarely)
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production

# Dynamic layers (change on every deploy)
COPY . .
EXPOSE 3000
CMD ["node", "server.js"]