Skip to content
cccskills
FreePublished on GitHub

create-dockerfile

Create general-purpose Dockerfiles for Node.js, Python, Go, Rust, and Java projects. Covers base image selection, dependency installation, user permissions, COPY patterns, ENTRYPOINT vs CMD, and .dockerignore. Use when containerizing an application for the first time, creating a consistent build/runtime environment, preparing an app for cloud deployment or Docker Compose, or when no existing Dockerfile is present in the project.

The English summary is being prepared. Showing the original description.

Works withDocker
See how to install

Files included (1)

  • SKILL.md6.1 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Create Dockerfile

Write a production-ready Dockerfile for general-purpose application projects.

When to Use

  • Containerizing a Node.js, Python, Go, Rust, or Java application
  • Creating a consistent build/runtime environment
  • Preparing an application for cloud deployment or Docker Compose
  • No existing Dockerfile in the project

Inputs

  • Required: Project language and entry point (e.g., npm start, python app.py)
  • Required: Dependency manifest (package.json, requirements.txt, go.mod, Cargo.toml, pom.xml)
  • Optional: Target environment (development or production)
  • Optional: Exposed ports

Procedure

Step 1: Choose Base Image

LanguageDev ImageProd ImageSize
Node.jsnode:22-bookwormnode:22-bookworm-slim~200MB
Pythonpython:3.12-bookwormpython:3.12-slim-bookworm~150MB
Gogolang:1.23-bookwormgcr.io/distroless/static~2MB
Rustrust:1.82-bookwormdebian:bookworm-slim~80MB
Javaeclipse-temurin:21-jdkeclipse-temurin:21-jre~200MB

Expected: Select the slim/distroless variant for production images.

Step 2: Write Dockerfile (by language)

Node.js

FROM node:22-bookworm-slim

RUN groupadd -r appuser && useradd -r -g appuser -m appuser

WORKDIR /app

COPY package.json package-lock.json ./
RUN npm ci --omit=dev

COPY . .

USER appuser
EXPOSE 3000
CMD ["node", "src/index.js"]

Python

FROM python:3.12-slim-bookworm

RUN groupadd -r appuser && useradd -r -g appuser -m appuser

WORKDIR /app

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

USER appuser
EXPOSE 8000
CMD ["python", "app.py"]

Go

FROM golang:1.23-bookworm AS builder

WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build -o /app/server ./cmd/server

FROM gcr.io/distroless/static
COPY --from=builder /app/server /server
EXPOSE 8080
ENTRYPOINT ["/server"]

Rust

FROM rust:1.82-bookworm AS builder

WORKDIR /src
COPY Cargo.toml Cargo.lock ./
RUN mkdir src && echo "fn main() {}" > src/main.rs && cargo build --release && rm -rf src

COPY . .
RUN touch src/main.rs && cargo build --release

FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
COPY --from=builder /src/target/release/myapp /usr/local/bin/myapp
EXPOSE 8080
ENTRYPOINT ["myapp"]

Java (Maven)

FROM eclipse-temurin:21-jdk AS builder

WORKDIR /src
COPY pom.xml .
RUN mvn dependency:go-offline -B
COPY src ./src
RUN mvn package -DskipTests

FROM eclipse-temurin:21-jre
COPY --from=builder /src/target/*.jar /app/app.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "/app/app.jar"]

Expected: docker build -t myapp . completes without errors.

On failure: Check base image availability and dependency installation commands.

Step 3: ENTRYPOINT vs CMD

DirectivePurposeOverride
ENTRYPOINTFixed executableOverride with --entrypoint
CMDDefault argumentsOverride with trailing args
BothENTRYPOINT + default args via CMDArgs override CMD only

Use ENTRYPOINT for compiled binaries with a single purpose. Use CMD for interpreted languages where you might want docker run myapp bash.

Step 4: Create .dockerignore

.git
.gitignore
node_modules
__pycache__
*.pyc
target/
.env
.env.*
*.md
!README.md
.vscode
.idea
Dockerfile
docker-compose*.yml

Expected: Build context excludes development artifacts.

Step 5: Add Non-Root User

Always run as non-root in production:

RUN groupadd -r appuser && useradd -r -g appuser -m appuser
USER appuser

For distroless images, use the built-in nonroot user:

FROM gcr.io/distroless/static:nonroot
USER nonroot

Step 6: Build and Verify

docker build -t myapp:latest .
docker run --rm myapp:latest
docker image inspect myapp:latest --format '{{.Size}}'

Expected: Container starts, responds on the expected port, runs as non-root.

On failure: Check logs with docker logs. Verify WORKDIR, COPY paths, and exposed ports.

Validation

  • docker build completes without errors
  • Container starts and application responds
  • .dockerignore excludes unnecessary files
  • Application runs as non-root user
  • Dependencies are copied before source code (cache efficiency)
  • No secrets or .env files baked into the image

Common Pitfalls

  • COPY before dependency install: Invalidates the dependency cache on every code change. Always copy the manifest file first.
  • Running as root: Default Docker user is root. Always add a non-root user for production.
  • Missing .dockerignore: Sending node_modules or .git into the build context wastes time and disk.
  • Using latest tag for base images: Pin to specific versions (e.g., node:22.11.0) for reproducibility.
  • Forgetting --no-cache-dir: Python pip caches packages by default, bloating the image.
  • ADD vs COPY: Use COPY unless you need URL download or tar extraction (ADD auto-extracts).

Related Skills

  • create-r-dockerfile - R-specific Dockerfile using rocker images
  • create-multistage-dockerfile - multi-stage patterns for minimal production images
  • optimize-docker-build-cache - advanced caching strategies
  • setup-compose-stack - orchestrate the containerized app with other services

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Execute structural metamorphosis using strangler fig migration, chrysalis phases, and interface preservation. Covers transformation planning, parallel running, progressive cutover, rollback design, and post-metamorphosis stabilization for system architecture evolution. Use when assess-form has classified the system as READY for transformation, when migrating from monolith to microservices, when replacing a core subsystem while dependents continue operating, or when any architectural change must be gradual rather than big-bang.

The English summary is being prepared. Showing the original description.

pjt222/agent-almanac42Updated Oct 15, 2026

Master skill composing the 5-step synoptic cycle for panoramic synthesis across multiple domains. Orchestrates meditate, expand-awareness, observe, awareness, integrate-gestalt, and express-insight into a coherent process that produces unified understanding rather than sequential compromise. Use when a problem genuinely spans 3+ domains and the interactions between domains matter more than depth in any one, when sequential analysis feels like compromise rather than integration, or before major architectural decisions affecting multiple stakeholders.

The English summary is being prepared. Showing the original description.

pjt222/agent-almanac42Updated Oct 15, 2026

Scaffold a new puzzle type across all 10+ pipeline integration points in jigsawR. Creates the core puzzle module, wires it into the unified pipeline (generation, positioning, rendering, adjacency), adds ggpuzzle geom/stat layers, updates DESCRIPTION and config.yml, extends the Shiny app, and creates a comprehensive test suite. Use when adding a completely new puzzle type to the package or following the 10-point integration checklist to ensure nothing is missed end-to-end.

The English summary is being prepared. Showing the original description.

pjt222/agent-almanac42Updated Oct 15, 2026

Add Rcpp or RcppArmadillo integration to an R package for high-performance C++ code. Covers setup, writing C++ functions, RcppExports generation, testing compiled code, and debugging. Use when an R function is too slow and profiling confirms a bottleneck, when you need to interface with existing C/C++ libraries, or when implementing algorithms (loops, recursion, linear algebra) that benefit from compiled code.

The English summary is being prepared. Showing the original description.

pjt222/agent-almanac42Updated Oct 15, 2026

aikido

Free

Practice aikido as a defensive martial art emphasizing harmony, redirection, and controlled resolution. Covers centering and grounding, ukemi (safe falling and rolling), core techniques (irimi-nage, shiho-nage, kote-gaeshi, ikkyo), blending and tai sabaki (body movement), randori (multiple attacker practice), weapons awareness, and applying principles off the mat. Use when learning a defensive martial art that prioritizes de-escalation, developing the ability to redirect aggression without causing unnecessary harm, building safe falling skills, or cultivating calm centeredness under physical pressure.

The English summary is being prepared. Showing the original description.

pjt222/agent-almanac42Updated Oct 15, 2026

Analyze an arbitrary codebase to identify functions, APIs, and data sources suitable for exposure as MCP tools, producing a tool specification document. Use when planning an MCP server for an existing project, auditing a codebase before wrapping it as an AI-accessible tool surface, comparing what a codebase can do versus what is already exposed via MCP, or generating a tool spec to hand off to scaffold-mcp-server.

The English summary is being prepared. Showing the original description.

pjt222/agent-almanac42Updated Oct 15, 2026

See all skills by pjt222

Report a problem with this skill