Skip to content

Commit beb63e2

Browse files
authored
Merge pull request #1 from python/cabotage
Deploy to Cabotage
2 parents 852bf50 + c08b405 commit beb63e2

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

Dockerfile

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
FROM node:18-bookworm AS frontend-base
2+
3+
# Install dependencies only when needed
4+
FROM frontend-base AS deps
5+
WORKDIR /app
6+
7+
# Copy package files
8+
COPY frontend/package*.json ./
9+
RUN npm ci
10+
11+
# Rebuild the source code only when needed
12+
FROM frontend-base AS frontend-builder
13+
WORKDIR /app
14+
COPY --from=deps /app/node_modules ./node_modules
15+
COPY ./frontend/ .
16+
17+
# Build the application
18+
RUN npm run build
19+
20+
21+
FROM python:3.13-slim-bookworm
22+
23+
WORKDIR /app
24+
25+
# Install system dependencies including PostgreSQL client libraries
26+
RUN apt-get update && apt-get install -y \
27+
build-essential \
28+
libpq-dev \
29+
curl \
30+
nodejs \
31+
socat \
32+
&& rm -rf /var/lib/apt/lists/*
33+
34+
# Copy requirements first to leverage Docker layer caching
35+
COPY backend/requirements.txt .
36+
37+
# Install PostgreSQL adapter
38+
RUN pip install --no-cache-dir asyncpg psycopg2-binary
39+
40+
# Install Python dependencies
41+
RUN pip install --no-cache-dir -r requirements.txt
42+
43+
# Copy the backend source code
44+
COPY ./backend/ .
45+
46+
47+
# Copy the nextjs application
48+
COPY --from=frontend-builder --chown=nobody /app/.next/standalone ./
49+
COPY --from=frontend-builder --chown=nobody /app/.next/static ./.next/static

Procfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
web-backend: python -m uvicorn app.main:app --uds /var/run/cabotage/cabotage.sock
2+
web-frontend: sh -c 'node server.js & socat UNIX-LISTEN:/var/run/cabotage/cabotage.sock,fork TCP:127.0.0.1:3000'
3+
release: echo 'doin deploy things'

0 commit comments

Comments
 (0)