diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 658e026..0000000 --- a/Dockerfile +++ /dev/null @@ -1,50 +0,0 @@ -FROM node:18-bookworm AS frontend-base - -# Install dependencies only when needed -FROM frontend-base AS deps -WORKDIR /app - -# Copy package files -COPY frontend/package*.json ./ -RUN npm ci - -# Rebuild the source code only when needed -FROM frontend-base AS frontend-builder -WORKDIR /app -COPY --from=deps /app/node_modules ./node_modules -COPY ./frontend/ . - -# Build the application -RUN npm run build - - -FROM python:3.13-slim-bookworm - -WORKDIR /app - -# Install system dependencies including PostgreSQL client libraries -RUN apt-get update && apt-get install -y \ - build-essential \ - libpq-dev \ - curl \ - nodejs \ - socat \ - && rm -rf /var/lib/apt/lists/* - -# Copy requirements first to leverage Docker layer caching -COPY backend/requirements.txt . - -# Install PostgreSQL adapter -RUN pip install --no-cache-dir asyncpg psycopg2-binary - -# Install Python dependencies -RUN pip install --no-cache-dir -r requirements.txt - -# Copy the backend source code -COPY ./backend/ . - -# Copy the nextjs application -COPY --from=frontend-builder --chown=nobody /app/.next/standalone ./ -COPY --from=frontend-builder --chown=nobody /app/.next/static ./.next/static - -COPY ./scripts ./scripts diff --git a/Procfile b/Procfile deleted file mode 100644 index 1dcedf3..0000000 --- a/Procfile +++ /dev/null @@ -1,3 +0,0 @@ -web-backend: python -m uvicorn app.main:app --uds /var/run/cabotage/cabotage.sock -web-frontend: ./scripts/start-frontend -release: echo 'doin deploy things' diff --git a/backend/Dockerfile b/backend/Dockerfile index ffe9e23..2d1d0b8 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.11-slim +FROM python:3.13-slim-bookworm WORKDIR /app @@ -33,4 +33,4 @@ HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \ CMD curl -f http://localhost:${API_PORT}/health || exit 1 # Run the application -CMD ["sh", "-c", "python -m uvicorn app.main:app --host ${API_HOST} --port ${API_PORT}"] \ No newline at end of file +CMD ["sh", "-c", "python -m uvicorn app.main:app --host ${API_HOST} --port ${API_PORT}"] diff --git a/backend/Procfile b/backend/Procfile new file mode 100644 index 0000000..b777566 --- /dev/null +++ b/backend/Procfile @@ -0,0 +1,2 @@ +web: python -m uvicorn app.main:app --uds /var/run/cabotage/cabotage.sock +release: echo 'doin deploy things' diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 84ee280..115c016 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,8 +1,7 @@ -FROM node:18-alpine AS base +FROM node:18-bookworm AS base # Install dependencies only when needed FROM base AS deps -RUN apk add --no-cache libc6-compat wget WORKDIR /app # Copy package files @@ -23,12 +22,16 @@ ENV NEXT_PUBLIC_API_BASE=$NEXT_PUBLIC_API_BASE RUN npm run build # Production image, copy all the files and run next -FROM base AS runner +FROM python:3.13-slim-bookworm AS runner WORKDIR /app ENV NODE_ENV=production -RUN apk add --no-cache wget +RUN apt-get update && apt-get install -y \ + wget \ + socat \ + nodejs \ + && rm -rf /var/lib/apt/lists/* RUN addgroup --system --gid 1001 nodejs RUN adduser --system --uid 1001 nextjs @@ -44,6 +47,8 @@ RUN chown nextjs:nodejs .next COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static +COPY ./scripts ./scripts + USER nextjs EXPOSE 3000 @@ -55,4 +60,4 @@ ENV HOSTNAME="0.0.0.0" HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \ CMD wget --no-verbose --tries=1 --spider http://localhost:3000/ || exit 1 -CMD ["node", "server.js"] \ No newline at end of file +CMD ["node", "server.js"] diff --git a/frontend/Procfile b/frontend/Procfile new file mode 100644 index 0000000..e8b57ea --- /dev/null +++ b/frontend/Procfile @@ -0,0 +1,2 @@ +web: ./scripts/start-frontend +release: echo 'doin deploy things' diff --git a/scripts/mv.py b/frontend/scripts/mv.py similarity index 100% rename from scripts/mv.py rename to frontend/scripts/mv.py diff --git a/scripts/start-frontend b/frontend/scripts/start-frontend similarity index 100% rename from scripts/start-frontend rename to frontend/scripts/start-frontend