Merge pull request #150 from OpenPipe/fix-build

(Probably) fixes the build
This commit is contained in:
Kyle Corbitt
2023-08-14 07:59:20 -07:00
committed by GitHub
4 changed files with 29 additions and 15 deletions

5
.dockerignore Normal file
View File

@@ -0,0 +1,5 @@
**/node_modules/
.git
**/.venv/
**/.env*
**/.next/

View File

@@ -6,13 +6,13 @@ RUN yarn global add pnpm
# DEPS # DEPS
FROM base as deps FROM base as deps
WORKDIR /app WORKDIR /code
COPY prisma ./ COPY app/prisma app/package.json ./app/
COPY client-libs/typescript/package.json ./client-libs/typescript/
COPY pnpm-lock.yaml pnpm-workspace.yaml ./
COPY package.json pnpm-lock.yaml ./ RUN cd app && pnpm install --frozen-lockfile
RUN pnpm install --frozen-lockfile
# BUILDER # BUILDER
FROM base as builder FROM base as builder
@@ -25,22 +25,24 @@ ARG NEXT_PUBLIC_SENTRY_DSN
ARG SENTRY_AUTH_TOKEN ARG SENTRY_AUTH_TOKEN
ARG NEXT_PUBLIC_FF_SHOW_LOGGED_CALLS ARG NEXT_PUBLIC_FF_SHOW_LOGGED_CALLS
WORKDIR /app WORKDIR /code
COPY --from=deps /app/node_modules ./node_modules COPY --from=deps /code/node_modules ./node_modules
COPY --from=deps /code/app/node_modules ./app/node_modules
COPY --from=deps /code/client-libs/typescript/node_modules ./client-libs/typescript/node_modules
COPY . . COPY . .
RUN SKIP_ENV_VALIDATION=1 pnpm build RUN cd app && SKIP_ENV_VALIDATION=1 pnpm build
# RUNNER # RUNNER
FROM base as runner FROM base as runner
WORKDIR /app WORKDIR /code/app
ENV NODE_ENV production ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1 ENV NEXT_TELEMETRY_DISABLED 1
COPY --from=builder /app/ ./ COPY --from=builder /code/ /code/
EXPOSE 3000 EXPOSE 3000
ENV PORT 3000 ENV PORT 3000
# Run the "run-prod.sh" script # Run the "run-prod.sh" script
CMD /app/run-prod.sh CMD /code/app/run-prod.sh

9
app/test-docker.sh Executable file
View File

@@ -0,0 +1,9 @@
#! /bin/bash
set -e
cd "$(dirname "$0")/.."
source app/.env
docker build . --file app/Dockerfile

View File

@@ -7,9 +7,8 @@ databases:
services: services:
- type: web - type: web
name: querykey-prod-web name: querykey-prod-web
rootDir: app
env: docker env: docker
dockerfilePath: Dockerfile dockerfilePath: ./app/Dockerfile
dockerContext: . dockerContext: .
plan: standard plan: standard
domains: domains:
@@ -32,9 +31,8 @@ services:
- type: web - type: web
name: querykey-prod-wss name: querykey-prod-wss
rootDir: app
env: docker env: docker
dockerfilePath: Dockerfile dockerfilePath: ./app/Dockerfile
dockerContext: . dockerContext: .
plan: free plan: free
dockerCommand: pnpm tsx src/wss-server.ts dockerCommand: pnpm tsx src/wss-server.ts