fix: issues with docker build process (#2744)

This commit is contained in:
Matti Nannt
2024-06-10 17:52:49 +02:00
committed by GitHub
parent 4878e8e43a
commit a143e9d1a3
9 changed files with 14703 additions and 11847 deletions

View File

@@ -35,3 +35,5 @@ yarn-error.log*
.vscode
.github
**/.turbo
.env

View File

@@ -3,13 +3,13 @@ FROM node:20-alpine AS base
#
## step 1: Prune monorepo
#
FROM base AS builder
RUN apk add --no-cache libc6-compat
RUN apk update
# FROM base AS builder
# RUN apk add --no-cache libc6-compat
# RUN apk update
# Set working directory
WORKDIR /app
RUN yarn global add turbo
COPY . .
# WORKDIR /app
# RUN yarn global add turbo
# COPY . .
# RUN turbo prune @formbricks/web --docker
#
@@ -35,21 +35,23 @@ ARG SENTRY_AUTH_TOKEN
WORKDIR /app
# Copy the package information
COPY .gitignore .gitignore
COPY --from=builder /app/out/json/ .
COPY --from=builder /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
# COPY .gitignore .gitignore
# COPY --from=builder /app/out/json/ .
# COPY --from=builder /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
# Install the dependencies
RUN pnpm install
# RUN pnpm install
# Prepare the build
COPY --from=builder /app/out/full/ .
COPY . .
# Create a .env file
RUN touch /app/apps/web/.env
RUN touch apps/web/.env
RUN pnpm install
# Build the project
RUN pnpm post-install --filter=@formbricks/web...
RUN pnpm turbo run build --filter=@formbricks/web...
# RUN pnpm post-install --filter=@formbricks/web...
RUN pnpm build --filter=@formbricks/web...
# Extract Prisma version
RUN jq -r '.devDependencies.prisma' packages/database/package.json > /prisma_version.txt

View File

@@ -13,7 +13,6 @@
"clean": "turbo run clean && rimraf node_modules .turbo coverage out",
"build": "turbo run build",
"build:dev": "turbo run build:dev",
"post-install": "turbo run post-install",
"db:migrate:dev": "turbo run db:migrate:dev",
"db:migrate:deploy": "turbo run db:migrate:deploy",
"db:migrate:vercel": "turbo run db:migrate:vercel",
@@ -56,7 +55,7 @@
"engines": {
"node": ">=16.0.0"
},
"packageManager": "pnpm@8.15.8",
"packageManager": "pnpm@9.2.0",
"nextBundleAnalysis": {
"budget": 358400,
"budgetPercentIncreaseRed": 20,

View File

@@ -21,8 +21,7 @@
"format": "prisma format",
"generate": "prisma generate",
"lint": "eslint ./src --fix",
"post-install": "pnpm generate",
"predev": "pnpm generate",
"build": "pnpm generate",
"data-migration:v1.6": "ts-node ./data-migrations/20240207041922_advanced_targeting/data-migration.ts",
"data-migration:styling": "ts-node ./data-migrations/20240320090315_add_form_styling/data-migration.ts",
"data-migration:styling-fix": "ts-node ./data-migrations/20240320090315_add_form_styling/data-migration-fix.ts",

View File

@@ -1,10 +1,10 @@
import "server-only";
import axios from "axios";
import { HttpsProxyAgent } from "https-proxy-agent";
import fetch from "node-fetch";
import { prisma } from "@formbricks/database";
import { cache, revalidateTag } from "@formbricks/lib/cache";
import { E2E_TESTING, ENTERPRISE_LICENSE_KEY, IS_FORMBRICKS_CLOUD } from "@formbricks/lib/constants";
import { env } from "@formbricks/lib/env";
import { hashString } from "@formbricks/lib/hashString";
import type { TOrganization } from "@formbricks/types/organizations";
@@ -83,13 +83,23 @@ export const getIsEnterpriseEdition = async (): Promise<boolean> => {
},
});
const response = await axios.post("https://ee.formbricks.com/api/licenses/check", {
licenseKey: process.env.ENTERPRISE_LICENSE_KEY,
usage: { responseCount },
const proxyUrl = env.HTTPS_PROXY || env.HTTP_PROXY;
const agent = proxyUrl ? new HttpsProxyAgent(proxyUrl) : undefined;
const res = await fetch("https://ee.formbricks.com/api/licenses/check", {
body: JSON.stringify({
licenseKey: ENTERPRISE_LICENSE_KEY,
usage: { responseCount: responseCount },
}),
headers: { "Content-Type": "application/json" },
method: "POST",
agent,
});
if (response.status === 200) {
const responseJson = response.data;
if (res.ok) {
const responseJson = (await res.json()) as {
data: { status: string; features: { isMultiOrgEnabled: boolean } };
};
return responseJson.data.status === "active";
}

View File

@@ -24,10 +24,10 @@
"@formbricks/lib": "workspace:*",
"@paralleldrive/cuid2": "^2.2.2",
"@radix-ui/react-collapsible": "^1.0.3",
"axios": "^1.7.2",
"lucide-react": "^0.390.0",
"next": "^14.2.3",
"next-auth": "^4.24.7",
"node-fetch": "^3.3.2",
"react-hook-form": "^7.51.5",
"react-hot-toast": "^2.4.1",
"server-only": "^0.0.1",

View File

@@ -31,6 +31,8 @@ export const env = createEnv({
GOOGLE_SHEETS_CLIENT_ID: z.string().optional(),
GOOGLE_SHEETS_CLIENT_SECRET: z.string().optional(),
GOOGLE_SHEETS_REDIRECT_URL: z.string().optional(),
HTTP_PROXY: z.string().url().optional(),
HTTPS_PROXY: z.string().url().optional(),
IMPRINT_URL: z
.string()
.url()
@@ -135,6 +137,8 @@ export const env = createEnv({
GOOGLE_SHEETS_CLIENT_ID: process.env.GOOGLE_SHEETS_CLIENT_ID,
GOOGLE_SHEETS_CLIENT_SECRET: process.env.GOOGLE_SHEETS_CLIENT_SECRET,
GOOGLE_SHEETS_REDIRECT_URL: process.env.GOOGLE_SHEETS_REDIRECT_URL,
HTTP_PROXY: process.env.HTTP_PROXY,
HTTPS_PROXY: process.env.HTTPS_PROXY,
IMPRINT_URL: process.env.IMPRINT_URL,
INVITE_DISABLED: process.env.INVITE_DISABLED,
IS_FORMBRICKS_CLOUD: process.env.IS_FORMBRICKS_CLOUD,

26468
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,6 @@
{
"$schema": "https://turborepo.org/schema.json",
"tasks": {
"@formbricks/database#build": {
"cache": false,
"dependsOn": ["post-install"]
},
"@formbricks/web#go": {
"cache": false,
"persistent": true,
@@ -84,6 +80,8 @@
"NOTION_OAUTH_CLIENT_ID",
"NOTION_OAUTH_CLIENT_SECRET",
"HEROKU_APP_NAME",
"HTTP_PROXY",
"HTTPS_PROXY",
"IMPRINT_URL",
"INSTANCE_ID",
"INTERNAL_SECRET",
@@ -154,12 +152,6 @@
"dependsOn": ["^build:dev"],
"outputs": ["dist/**", ".next/**"]
},
"post-install": {
"cache": false,
"dependsOn": [],
"outputs": [],
"inputs": ["./schema.prisma"]
},
"db:setup": {
"cache": false,
"outputs": []