wowprompt

Dockerfile and Docker Compose setup for an existing app

Writes a production-ready Dockerfile, a Docker Compose file for local development and a short run guide for an app you describe. Use it when containerising an existing project so it runs the same on every machine and server.

A multi-stage Dockerfile, a docker-compose file with app and database services, a .dockerignore list and a run guide with commands
The output this prompt produced, unedited.

The prompt

Goal

Run the app in containers with small images, no secrets baked in and one command to start local development.

Inputs

  • Language, framework and version: [e.g. Node 20 with Next.js, Python 3.12 with Django]
  • How the app is built and started now: [commands]
  • Services it needs: [e.g. PostgreSQL 16, Redis, none]
  • Environment variables it reads: [names only, no values]
  • Port the app listens on: [port]
  • Where it will run: [local only, a VPS, a cloud service]

Steps

  1. Write a multi-stage Dockerfile: build stage with dev dependencies, final stage with only what runs.
  2. Use a pinned official base image and run as a non-root user.
  3. Write a docker-compose file for local development with the services, volumes and a health check.
  4. Write a .dockerignore.
  5. Write a run guide with the commands to build, start, view logs and stop.

Output format

  • Dockerfile in a code block, with a one-line comment above each stage.
  • docker-compose.yml in a code block.
  • .dockerignore in a code block.
  • Run guide as numbered commands.
  • A list of decisions you made and why, such as the base image.

Check before answering

  • No secret values appear in any file; variables are read from an env file that is ignored by git.
  • Dependency install comes before copying the source, so layers cache well.
  • The final image does not contain build tools or test files.
  • Every assumption about the app is stated, not hidden in the files.
dockerfiledocker composecontainerize appdocker setupmulti stage builddev environment docker

How to run this

Copy the prompt and paste it into Gemini, then set the aspect ratio to 3:4. No reference photo is needed for this one.

The prompt is written in Markdown with each part under its own heading, which is what the copy action hands over. Change one section at a time, keeping the rest intact, so you can tell which change did the work.

Related prompts

All productivity