Skip to main content
PC Fix includes a complete Docker Compose configuration for running the entire stack (PostgreSQL, API, and Web) in containers. This guide covers Docker-based deployment for both local development and production environments.

Overview

The Docker setup provides three services:
  • postgres: PostgreSQL 15 Alpine database
  • api: Express backend (Node.js)
  • web: Astro frontend with React islands
All services are connected via Docker’s internal network, enabling seamless communication without exposing unnecessary ports.

Prerequisites

1

Install Docker

Install Docker Desktop or Docker Engine:
2

Install Docker Compose

Docker Compose is included in Docker Desktop. For Linux:
3

Verify Installation

Docker Compose Configuration

The docker-compose.yml file defines the complete stack:
docker-compose.yml

Development Deployment

Initial Setup

1

Clone Repository

2

Configure Environment Variables

Create .env files for both packages (see Environment Setup):
Edit both files with your actual credentials.
3

Build and Start Containers

This will:
  • Build Docker images for API and Web
  • Start PostgreSQL container
  • Run Prisma migrations
  • Start API on port 3001
  • Start Web on port 4321

Access Services

Once running, access:
Use Prisma Studio to explore the database:
Access at http://localhost:5555

Docker Commands Reference

Basic Operations

Container Management

Database Operations

Production Deployment

Docker Production Build

For production, create a docker-compose.prod.yml:
docker-compose.prod.yml

Deploy to Production

1

Set Production Environment

Create .env.production with production credentials:
2

Build Production Images

3

Start Production Stack

4

Run Migrations

Health Monitoring

Add health checks to docker-compose.prod.yml:

Alternative Deployment Options

Deploy the web package to Vercel:
  1. Install Vercel CLI:
  1. Deploy from packages/web:
  1. Set environment variables in Vercel dashboard:
  • PUBLIC_API_URL
  • PUBLIC_GOOGLE_CLIENT_ID
  • PUBLIC_SENTRY_DSN
PC Fix already includes @astrojs/vercel adapter in astro.config.mjs

Troubleshooting

If ports 3001, 4321, or 5432 are in use:
Check container logs:
Common issues:
  • Missing environment variables
  • Database connection failed
  • Port conflicts
Ensure:
  • PostgreSQL container is running: docker ps
  • Use host postgres in DATABASE_URL (not localhost)
  • Wait for postgres to be ready before API starts
Hot reload requires volumes to be mounted correctly:

Next Steps

Database Migrations

Learn how to manage schema changes

Testing

Run tests in Docker containers

Environment Setup

Configure environment variables

Architecture

Understand the system architecture