Deployment

Linkblog is designed to run on AWS App Runner via Docker. This page covers building the image, configuring the environment, and deploying.

Docker

Dockerfile (planned)

A multi-stage build keeps the production image small:

# Stage 1: Build
FROM node:20-alpine AS build
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN corepack enable && pnpm install --frozen-lockfile
COPY . .
RUN pnpm build

# Stage 2: Production
FROM node:20-alpine
WORKDIR /app
COPY --from=build /app/dist ./dist
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/package.json ./
EXPOSE 3000
CMD ["node", "dist/main"]

.dockerignore

node_modules
.git
.env
dist
coverage
docs
supabase/.temp

Build and Run Locally

docker build -t linkblog .
docker run -p 3000:3000 \
  -e SUPABASE_URL=https://your-project.supabase.co \
  -e SUPABASE_ANON_KEY=your-anon-key \
  -e API_KEY=your-api-key \
  linkblog

AWS App Runner

Environment Variables

Configure these in the App Runner service settings:

Variable Description
SUPABASE_URL Supabase project URL
SUPABASE_ANON_KEY Supabase anonymous key
API_KEY Secret key for write endpoints
PORT App Runner sets this automatically

Health Check

App Runner uses GET /health to determine if the service is healthy. The endpoint returns 200 OK with no authentication required.

Configure the health check in App Runner:

Deployment Steps

  1. Push image to ECR (or connect App Runner to your GitHub repo for source-based deploys)
  2. Create App Runner service with the container image
  3. Set environment variables in the service configuration
  4. Configure health check to use /health
  5. App Runner assigns a public URL — use that or configure a custom domain

Custom Domain

To use a custom domain with App Runner:

  1. Go to the App Runner service in the AWS console
  2. Under Custom domains, add your domain
  3. Create the DNS records (CNAME) as instructed
  4. Wait for certificate validation

CI/CD (planned)

A GitHub Actions workflow can automate deployment:

  1. On push to main:
    • Run tests
    • Build Docker image
    • Push to ECR
    • Trigger App Runner deployment

Next: Implementation Plan