Tweaking the docker files and prisma to prepare for reliable aws deployments

This commit is contained in:
Keith Stevens
2022-12-26 12:07:40 +09:00
parent 5729e722a3
commit 8ffaf71aa7
3 changed files with 7 additions and 16 deletions
+3 -15
View File
@@ -1,7 +1,5 @@
# Install dependencies only when needed
FROM node:16.19 AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
# RUN apk add --no-cache libc6-compat
FROM node:16.18.0 AS deps
WORKDIR /app
# Install dependencies based on the preferred package manager
@@ -12,27 +10,19 @@ RUN \
fi
# Rebuild the source code only when needed
FROM node:16.19 AS builder
FROM node:16.18.0 AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY ./website/ .
# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry during the build.
# ENV NEXT_TELEMETRY_DISABLED 1
# RUN yarn build
RUN npx prisma generate
RUN npm run build
# Production image, copy all the files and run next
FROM node:16.19 AS runner
FROM node:16.18.0 AS runner
WORKDIR /app
ENV NODE_ENV production
# Uncomment the following line in case you want to disable telemetry during runtime.
# ENV NEXT_TELEMETRY_DISABLED 1
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
@@ -48,8 +38,6 @@ COPY --chown=nextjs:nodejs ./website/prisma/schema.prisma ./
# https://docs.docker.com/compose/startup-order/
COPY --chown=nextjs:nodejs ./website/wait-for-postgres.sh ./
# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
+3 -1
View File
@@ -12,6 +12,8 @@ services:
extends:
file: ../frontend-development/docker-compose.yaml
service: webdb
environment:
POSTGRES_DB: oasst_web
# This lets you manually inspect the web and backend databases.
adminer:
@@ -40,7 +42,7 @@ services:
context: ../../
image: oasst-web
environment:
- DATABASE_URL=postgres://postgres:postgres@webdb/ocgpt_website
- DATABASE_URL=postgres://postgres:postgres@webdb/oasst_web
- FASTAPI_URL=http://backend:8080
- FASTAPI_KEY=1234
- NEXTAUTH_SECRET=O/M2uIbGj+lDD2oyNa8ax4jEOJqCPJzO53UbWShmq98=
+1
View File
@@ -5,6 +5,7 @@ datasource db {
generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "linux-musl"]
}
model Account {