── GENERATED OUTPUT ──

Docker

Language-specific, production-ready Dockerfiles with multi-stage builds.

## Generation

bash
exo gen docker

Generates a Dockerfile in the project root. The template is selected based on the language field in .exo.yaml.

## Go Dockerfile

Dockerfile
1# ── Build Stage ──
2FROM golang:1.21-alpine AS builder
3WORKDIR /app
4COPY go.mod go.sum ./
5RUN go mod download
6COPY . .
7RUN CGO_ENABLED=0 GOOS=linux go build -o /app-name
8
9# ── Runtime Stage ──
10FROM alpine:latest
11RUN apk --no-cache add ca-certificates
12WORKDIR /root/
13COPY --from=builder /app-name .
14EXPOSE 8080
15CMD ["./app-name"]

## Node.js Dockerfile

Dockerfile
1FROM node:18-alpine AS builder
2WORKDIR /app
3COPY package*.json ./
4RUN npm ci --only=production
5
6FROM node:18-alpine
7WORKDIR /app
8COPY --from=builder /app/node_modules ./node_modules
9COPY . .
10EXPOSE 3000
11CMD ["node", "index.js"]

## Python Dockerfile

Dockerfile
1FROM python:3.11-slim
2WORKDIR /app
3COPY requirements.txt .
4RUN pip install --no-cache-dir -r requirements.txt
5COPY . .
6EXPOSE 8000
7CMD ["python", "app.py"]

## Features

▸ Multi-stage builds for smaller final images
▸ Alpine base images for minimal attack surface
▸ Dependency caching via layer ordering
▸ CGO disabled for Go (static binary)
▸ Production-only npm install for Node
▸ No-cache pip install for Python