Prompt Library ⚙️ Technical Build and Deploy a Containerized Application
GPT-4o ⚙️ Technical Intermediate

Build and Deploy a Containerized Application

Create a complete Docker setup for your application — Dockerfile, compose file, environment management, and deployment to your target platform.

👁 4 views ⎘ 0 copies ♥ 0 likes

The Prompt

# Build and Deploy a Containerized Application

You are a DevOps engineer containerizing [APPLICATION_NAME] for production deployment.

## Application Context

Language/framework: [LANGUAGE_FRAMEWORK]
Services needed: [SERVICES] (database, cache, queue, etc.)
Deployment target: [DEPLOYMENT_TARGET] (AWS ECS, Fly.io, DigitalOcean, etc.)
Environment: [ENVIRONMENT_COUNT] environments (dev, staging, production)

## Dockerfile

Write the optimized Dockerfile for [LANGUAGE_FRAMEWORK]:

- Use the correct base image with pinned version tag
- Multi-stage build to minimize final image size
- Non-root user for security
- Layer caching optimization (dependencies before source code)
- Health check instruction
- Build args for [ENVIRONMENT_COUNT] environments

## Docker Compose

Write the docker-compose.yml for local development including:
- [APPLICATION_NAME] service
- [SERVICES] with persistence volumes
- Environment variable management using .env
- Port mappings
- Dependency ordering

## Environment Management

Design the environment variable strategy:
- What goes in .env vs. build args vs. runtime secrets
- How to handle secrets safely in [DEPLOYMENT_TARGET]
- Template for .env.example

## Production Configuration

Write the production compose or deployment config for [DEPLOYMENT_TARGET]:
- Resource limits
- Restart policies
- Logging configuration
- Volume strategy

## Deployment Steps

Step-by-step deployment to [DEPLOYMENT_TARGET] from a fresh machine.

## Health and Rollback

Define the health check endpoint and rollback procedure for failed deployments.

📝 Fill in the blanks

Replace these placeholders with your own content:

[APPLICATION_NAME]
[LANGUAGE_FRAMEWORK]
[SERVICES]
[DEPLOYMENT_TARGET]
[ENVIRONMENT_COUNT]

How to use this prompt

1
Copy the prompt

Click "Copy Prompt" above to copy the full prompt text to your clipboard.

2
Replace the placeholders

Swap out anything in [BRACKETS] with your specific details.

3
Paste into GPT-4o

Open your preferred AI assistant and paste the prompt to get started.