Skip to content

Commit

Permalink
all_apps/apps now building!
Browse files Browse the repository at this point in the history
  • Loading branch information
djkato committed May 14, 2024
1 parent fabed98 commit cc107dd
Show file tree
Hide file tree
Showing 11 changed files with 422 additions and 28 deletions.
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[workspace]
members = ["modify-saleor-app", "modify-turbo-json"]
members = ["modify-saleor-app", "modify-turbo-json", "modify-next-config"]
resolver = "2"
27 changes: 0 additions & 27 deletions Dockerfile

This file was deleted.

60 changes: 60 additions & 0 deletions apps.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
FROM node:18-alpine AS base

FROM base AS builder
RUN apk add --no-cache libc6-compat
RUN apk update
# Set working directory
WORKDIR /app
RUN npm i -g turbo pnpm
COPY . .

ARG TARGET_APP
# Generate a partial monorepo with a pruned lockfile for a target workspace.
RUN turbo prune "app-$TARGET_APP" --docker
# Assuming "TARGET_APP" is the name entered in the project's package.json: { name: "TARGET_APP" }

# Add lockfile and package.json's of isolated subworkspace
FROM base AS installer

ARG TARGET_APP
RUN apk add --no-cache libc6-compat
RUN apk update
WORKDIR /app

# First install the dependencies (as they change less often)
COPY .gitignore .gitignore
COPY --from=builder /app/out/json/ .
RUN npm i -g turbo pnpm
RUN pnpm i

# Build the project
COPY --from=builder /app/out/full/ .
RUN turbo run build --filter="app-$TARGET_APP"...


FROM base AS runner

ARG TARGET_APP
WORKDIR /app

# Don't run production as root
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
USER nextjs

COPY --from=installer /app/apps/$TARGET_APP/next.config.js .
COPY --from=installer /app/apps/$TARGET_APP/package.json .

# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=installer --chown=nextjs:nodejs /app/apps/$TARGET_APP/.next/standalone ./
COPY --from=installer --chown=nextjs:nodejs /app/apps/$TARGET_APP/.next/static ./apps/$TARGET_APP/.next/static
COPY --from=installer --chown=nextjs:nodejs /app/apps/$TARGET_APP/public ./apps/$TARGET_APP/public
COPY --from=installer --chown=nextjs:nodejs /app/node_modules ./node_modules
# COPY --from=installer --chown=nextjs:nodejs /app/node_modules/next/dist/server/future/route-modules ./node_modules/next/dist/server/future/route-modules
# COPY --from=installer --chown=nextjs:nodejs /app/node_modules/next/dist/compiled/next-server ./node_modules/next/dist/compiled/next-server
# COPY --from=installer --chown=nextjs:nodejs /app/node_modules/next/dist/compiled/next-server ./node_modules/next/dist/compiled/next-server
# COPY --from=installer --chown=nextjs:nodejs /app/node_modules/react/jsx-runtime ./node_modules/react/jsx-runtime

WORKDIR /app/apps/$TARGET_APP
CMD node server.js
6 changes: 6 additions & 0 deletions changes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ redis_apl_target_paths=(
"saleor-app-payment-klarna/src"
"saleor-app-payment-stripe/src"
)
echo "copying Dockerfiles..."
cp -f ./apps.Dockerfile ./all_apps/apps/
cp -f ./abandoned-cart.Dockerfile ./all_apps/apps/

echo "copying redis_apls..."
for i in ${redis_apl_target_paths[*]}; do
Expand All @@ -51,6 +54,9 @@ done
find ./all_apps/apps -name "saleor-app.ts" -exec cargo run --package modify-saleor-app -- {} \;
echo "pached all_apps/apps/**/saleor-app.ts"

find ./all_apps/apps -name "next.config.js" -exec cargo run --package modify-saleor-app -- {} \;
echo "pached all_apps/apps/**/saleor-app.ts"

find ./all_apps/saleor-app-abandoned-checkouts -name "saleor-app.ts" -exec cargo run --package modify-saleor-app -- {} \;
echo "pached all_apps/saleor-app-abandoned-checkouts/**/saleor-app.ts"

Expand Down
4 changes: 4 additions & 0 deletions changes/snippets/apps-next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
output: "standalone",
experimental: {
outputFileTracingRoot: path.join(process.cwd(), "../../"),
},
1 change: 1 addition & 0 deletions changes/snippets/import-path-app-next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const path = require("path");
230 changes: 230 additions & 0 deletions modify-next-config/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions modify-next-config/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "modify-next-config"
version = "0.1.0"
edition = "2021"

[dependencies]
# owo-colors = "4.0.0"
serde = { version = "1.0.198", features = ["derive"] }
serde_json = "1.0.116"
spinners = "4.1.1"
thiserror = "1.0.58"
walkdir = "2.5.0"
Loading

0 comments on commit cc107dd

Please sign in to comment.