Dockerfile Deployments
Deploy applications using your own Dockerfile.
Dockerfile deployments build your container image directly on the cluster -- no local Docker daemon required.
Requirements
Your repository must contain a Dockerfile (or specify a custom path to one).
How it works
- Convoy Cloud clones your repository at the specified commit.
- Each instruction in your
Dockerfileis executed to produce the final image. - The resulting image is stored in Convoy Cloud's private registry.
- The image is deployed to your isolated environment.
Configuration options
Dockerfile path
By default, Convoy Cloud looks for a file named Dockerfile in the root of your repository. If your Dockerfile is in a different location, specify the path relative to the build context:
# Examples
Dockerfile # default
docker/Dockerfile.prod # custom location
services/api/Dockerfile # monorepoBuild context
The build context is the directory sent to the build process. It defaults to the repository root (.). For monorepos, set this to the subdirectory containing your application:
# Examples
. # default — entire repo
services/api # monorepo — only the api directory
frontend # monorepo — only the frontend directoryFiles outside the build context are not available during the build.
Example Dockerfiles
Node.js application
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM node:20-alpine
WORKDIR /app
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./
EXPOSE 8080
CMD ["node", "dist/index.js"]Python application
FROM python:3.12-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 8080
CMD ["gunicorn", "--bind", "0.0.0.0:8080", "app:app"]Go application
FROM golang:1.22-alpine AS builder
WORKDIR /app
COPY go.* ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build -o server .
FROM alpine:3.19
WORKDIR /app
COPY --from=builder /app/server .
EXPOSE 8080
CMD ["./server"]Build resources
Each build runs with configurable resource limits:
- CPU: up to 2000m (2 vCPUs)
- Memory: up to 4 GB
Tips
- Use multi-stage builds to keep your final image small. Smaller images deploy faster.
- Order your Dockerfile layers so that infrequently changing steps (like dependency installation) come first. This maximizes cache hits.
- Ensure your app listens on the configured port (default:
8080). Convoy Cloud injects aPORTenvironment variable automatically. - Use
.dockerignoreto exclude unnecessary files (likenode_modules,.git, test files) from the build context.
Under the hood Dockerfile builds run with Kaniko.