From df4a3a09504839af6bb98c9db0fb1eac364a6354 Mon Sep 17 00:00:00 2001 From: Kyle Corbitt Date: Sat, 12 Aug 2023 23:50:31 -0700 Subject: [PATCH] (Probably) fixes the build This probably fixes the build that I broke in https://github.com/OpenPipe/OpenPipe/pull/149. However, there's a small chance that it fixes it enough to deploy, but not enough to actually work. That would be bad, so not merging until I have time to monitor the deploy. --- .dockerignore | 5 +++++ app/Dockerfile | 24 +++++++++++++----------- app/test-docker.sh | 9 +++++++++ render.yaml | 6 ++---- 4 files changed, 29 insertions(+), 15 deletions(-) create mode 100644 .dockerignore create mode 100755 app/test-docker.sh diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..7914a02 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +**/node_modules/ +.git +**/.venv/ +**/.env* +**/.next/ diff --git a/app/Dockerfile b/app/Dockerfile index 3ef59e3..442801e 100644 --- a/app/Dockerfile +++ b/app/Dockerfile @@ -6,13 +6,13 @@ RUN yarn global add pnpm # 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 pnpm install --frozen-lockfile +RUN cd app && pnpm install --frozen-lockfile # BUILDER FROM base as builder @@ -25,22 +25,24 @@ ARG NEXT_PUBLIC_SENTRY_DSN ARG SENTRY_AUTH_TOKEN ARG NEXT_PUBLIC_FF_SHOW_LOGGED_CALLS -WORKDIR /app -COPY --from=deps /app/node_modules ./node_modules +WORKDIR /code +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 . . -RUN SKIP_ENV_VALIDATION=1 pnpm build +RUN cd app && SKIP_ENV_VALIDATION=1 pnpm build # RUNNER FROM base as runner -WORKDIR /app +WORKDIR /code/app ENV NODE_ENV production ENV NEXT_TELEMETRY_DISABLED 1 -COPY --from=builder /app/ ./ +COPY --from=builder /code/ /code/ EXPOSE 3000 ENV PORT 3000 # Run the "run-prod.sh" script -CMD /app/run-prod.sh \ No newline at end of file +CMD /code/app/run-prod.sh \ No newline at end of file diff --git a/app/test-docker.sh b/app/test-docker.sh new file mode 100755 index 0000000..895a5cc --- /dev/null +++ b/app/test-docker.sh @@ -0,0 +1,9 @@ +#! /bin/bash + +set -e + +cd "$(dirname "$0")/.." + +source app/.env + +docker build . --file app/Dockerfile \ No newline at end of file diff --git a/render.yaml b/render.yaml index c29cc44..7fdd631 100644 --- a/render.yaml +++ b/render.yaml @@ -7,9 +7,8 @@ databases: services: - type: web name: querykey-prod-web - rootDir: app env: docker - dockerfilePath: Dockerfile + dockerfilePath: ./app/Dockerfile dockerContext: . plan: standard domains: @@ -32,9 +31,8 @@ services: - type: web name: querykey-prod-wss - rootDir: app env: docker - dockerfilePath: Dockerfile + dockerfilePath: ./app/Dockerfile dockerContext: . plan: free dockerCommand: pnpm tsx src/wss-server.ts