Skip to content

Commit

Permalink
Merge pull request #2 from platacard/compose-docker-build
Browse files Browse the repository at this point in the history
Compose docker build
  • Loading branch information
parabolabamse authored Feb 10, 2025
2 parents 83d1a69 + d71521f commit 5b3d8fd
Show file tree
Hide file tree
Showing 6 changed files with 210 additions and 690 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,8 @@ dist
# should be here otherwise if placed inside prisma-client pnpm deploy doesn't copy it
packages/prisma-client/src/__generated__

.temp
.temp


.nx/cache
.nx/workspace-data
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM node:22.13.1-alpine AS base

WORKDIR /app
# note: all these files need because of pnpm workspace
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
COPY packages ./packages
COPY patches ./patches

COPY apps/builder/build ./apps/builder/build
COPY apps/builder/package.json ./apps/builder/package.json

FROM base AS prod-deps
RUN npm i -g [email protected]
RUN pnpm i --prod --frozen-lockfile --filter @webstudio-is/builder

FROM node:22.13.1-alpine
WORKDIR /app/apps/builder

COPY --from=base /app/apps/builder/build ./build

COPY --from=prod-deps /app/node_modules ../../node_modules
COPY --from=prod-deps /app/apps/builder/node_modules ./node_modules

EXPOSE 13100
CMD ["npx", "remix-serve", "build/server/index.js"]
5 changes: 1 addition & 4 deletions apps/builder/.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
DATABASE_URL=postgresql://postgres:pass@localhost/webstudio?pgbouncer=true
DIRECT_URL=postgresql://postgres:pass@localhost/webstudio

AUTH_SECRET="# Linux: $(openssl rand -hex 32) or go to https://generate-secret.now.sh/64"
AUTH_SECRET="rand"
DEV_LOGIN=true

# Restrictions
Expand Down Expand Up @@ -47,13 +47,10 @@ FEATURES=*
# Current user plan features (default)
USER_PLAN=pro


# TRCP server url and API token. If empty local TRPC server is used
# TRPC_SERVER_URL=
# TRPC_SERVER_API_TOKEN=

# AI Features
# OPENAI_KEY=
# OPENAI_ORG=


54 changes: 27 additions & 27 deletions apps/builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,33 @@
"test": "pnpm build:http-client && vitest run"
},
"dependencies": {
"@remix-run/node": "^2.15.2",
"@remix-run/react": "^2.15.2",
"@remix-run/serve": "^2.15.2",
"@remix-run/server-runtime": "^2.15.2",
"@trpc/client": "^10.45.2",
"@trpc/server": "^10.45.2",
"@tsndr/cloudflare-worker-jwt": "^2.5.3",
"cookie": "^1.0.1",
"debug": "^4.3.7",
"fast-deep-equal": "^3.1.3",
"immer": "^10.1.1",
"isbot": "^5.1.21",
"nanoid": "^5.0.9",
"react": "18.3.0-canary-14898b6a9-20240318",
"react-dom": "18.3.0-canary-14898b6a9-20240318",
"react-router-dom": "^6.28.1",
"remix-auth": "^3.7.0",
"remix-auth-form": "^1.5.0",
"remix-auth-google": "^2.0.0",
"remix-auth-oauth2": "^2.3.0",
"slugify": "^1.6.6",
"tiny-invariant": "^1.3.3",
"warn-once": "^0.1.1",
"zod": "^3.22.4",
"zod-validation-error": "^3.3.1"
},
"devDependencies": {
"@atlaskit/pragmatic-drag-and-drop": "^1.4.0",
"@codemirror/autocomplete": "^6.18.4",
"@codemirror/commands": "^6.8.0",
Expand Down Expand Up @@ -46,13 +73,6 @@
"@radix-ui/react-tooltip": "^1.1.6",
"@react-aria/interactions": "^3.22.5",
"@react-aria/utils": "^3.26.0",
"@remix-run/node": "^2.15.2",
"@remix-run/react": "^2.15.2",
"@remix-run/serve": "^2.15.2",
"@remix-run/server-runtime": "^2.15.2",
"@trpc/client": "^10.45.2",
"@trpc/server": "^10.45.2",
"@tsndr/cloudflare-worker-jwt": "^2.5.3",
"@vercel/remix": "2.15.2",
"@webstudio-is/asset-uploader": "workspace:*",
"@webstudio-is/authorization-token": "workspace:*",
Expand Down Expand Up @@ -80,55 +100,35 @@
"bcp-47": "^2.1.0",
"change-case": "^5.4.4",
"colord": "^2.9.3",
"cookie": "^1.0.1",
"css-tree": "^2.3.1",
"debug": "^4.3.7",
"downshift": "^6.1.7",
"fast-deep-equal": "^3.1.3",
"immer": "^10.1.1",
"immerhin": "^0.10.0",
"isbot": "^5.1.21",
"lexical": "^0.21.0",
"match-sorter": "^8.0.0",
"mdast-util-from-markdown": "^2.0.2",
"mdast-util-gfm": "^3.0.0",
"micromark-extension-gfm": "^3.0.0",
"nanoevents": "^9.1.0",
"nanoid": "^5.0.9",
"nanostores": "^0.11.3",
"picocolors": "^1.1.1",
"pretty-bytes": "^6.1.1",
"react": "18.3.0-canary-14898b6a9-20240318",
"react-colorful": "^5.6.1",
"react-dom": "18.3.0-canary-14898b6a9-20240318",
"react-error-boundary": "^5.0.0",
"react-script-hook": "^1.7.2",
"remix-auth": "^3.7.0",
"remix-auth-form": "^1.5.0",
"remix-auth-google": "^2.0.0",
"remix-auth-oauth2": "^2.3.0",
"shallow-equal": "^3.1.0",
"slugify": "^1.6.6",
"strip-indent": "^4.0.0",
"tiny-invariant": "^1.3.3",
"title-case": "^4.3.2",
"ultraflag": "^0.2.3",
"untruncate-json": "^0.0.1",
"urlpattern-polyfill": "^10.0.0",
"use-debounce": "^10.0.4",
"warn-once": "^0.1.1",
"zod": "^3.22.4",
"zod-validation-error": "^3.3.1"
},
"devDependencies": {
"@remix-run/dev": "^2.15.2",
"@types/debug": "^4.1.12",
"@types/dom-navigation": "^1.0.4",
"@types/react": "^18.2.70",
"@types/react-dom": "^18.2.25",
"@webstudio-is/tsconfig": "workspace:*",
"html-tags": "^4.0.0",
"react-router-dom": "^6.28.1",
"react-test-renderer": "18.3.0-canary-14898b6a9-20240318",
"type-fest": "^4.32.0",
"typescript": "5.7.3",
Expand Down
90 changes: 45 additions & 45 deletions apps/builder/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default defineConfig(({ mode }) => {
return {
plugins: [
remix({
presets: [vercelPreset()],
presets: [],
future: {
v3_lazyRouteDiscovery: false,
v3_relativeSplatPath: false,
Expand Down Expand Up @@ -86,50 +86,50 @@ export default defineConfig(({ mode }) => {
define: {
"process.env.NODE_ENV": JSON.stringify(mode),
},
server: {
// Service-to-service OAuth token call requires a specified host for the wstd.dev domain
host: "wstd.dev",
// Needed for SSL
proxy: {},

https: {
key: readFileSync("../../https/privkey.pem"),
cert: readFileSync("../../https/fullchain.pem"),
},
cors: ((
req: IncomingMessage,
callback: (error: Error | null, options: CorsOptions | null) => void
) => {
// Handle CORS preflight requests in development to mimic Remix production behavior
if (req.method === "OPTIONS" || req.method === "POST") {
if (req.headers.origin != null && req.url != null) {
const url = new URL(req.url, `https://${req.headers.host}`);

// Allow CORS for /builder-logout path when requested from the authorization server
if (url.pathname === "/builder-logout" && isBuilderUrl(url.href)) {
return callback(null, {
origin: getAuthorizationServerOrigin(url.href),
preflightContinue: false,
credentials: true,
});
}
}

if (req.method === "OPTIONS") {
// Respond with method not allowed for other preflight requests
return callback(null, {
preflightContinue: false,
optionsSuccessStatus: 405,
});
}
}

// Disable CORS for all other requests
return callback(null, {
origin: false,
});
}) as never,
},
// server: {
// // Service-to-service OAuth token call requires a specified host for the wstd.dev domain
// host: "wstd.dev",
// // Needed for SSL
// proxy: {},
//
// https: {
// key: readFileSync("../../https/privkey.pem"),
// cert: readFileSync("../../https/fullchain.pem"),
// },
// cors: ((
// req: IncomingMessage,
// callback: (error: Error | null, options: CorsOptions | null) => void
// ) => {
// // Handle CORS preflight requests in development to mimic Remix production behavior
// if (req.method === "OPTIONS" || req.method === "POST") {
// if (req.headers.origin != null && req.url != null) {
// const url = new URL(req.url, `https://${req.headers.host}`);
//
// // Allow CORS for /builder-logout path when requested from the authorization server
// if (url.pathname === "/builder-logout" && isBuilderUrl(url.href)) {
// return callback(null, {
// origin: getAuthorizationServerOrigin(url.href),
// preflightContinue: false,
// credentials: true,
// });
// }
// }
//
// if (req.method === "OPTIONS") {
// // Respond with method not allowed for other preflight requests
// return callback(null, {
// preflightContinue: false,
// optionsSuccessStatus: 405,
// });
// }
// }
//
// // Disable CORS for all other requests
// return callback(null, {
// origin: false,
// });
// }) as never,
// },
envPrefix: "GITHUB_",
};
});
Loading

0 comments on commit 5b3d8fd

Please sign in to comment.