Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to node 20 #174

Merged
merged 1 commit into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: ⎔ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: "pnpm"

- name: 📥 Download deps
Expand All @@ -55,7 +55,7 @@ jobs:
- name: ⎔ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: "pnpm"

- name: 📥 Download deps
Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:
- name: ⎔ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: "pnpm"

- name: 📥 Download deps
Expand Down Expand Up @@ -122,7 +122,7 @@ jobs:
- name: ⎔ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: "pnpm"

- name: 🏄 Copy test env vars
Expand Down
4 changes: 2 additions & 2 deletions apps/remix-app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
ARG APP_DIRNAME=remix-app
ARG APP_PKG_NAME=@remix-gospel-stack/remix-app

FROM node:18-bookworm-slim AS pruner
FROM node:20-bookworm-slim AS pruner
ARG APP_PKG_NAME
RUN apt-get update && apt-get install -y openssl
WORKDIR /app
Expand All @@ -12,7 +12,7 @@ COPY . .
RUN turbo prune --scope=$APP_PKG_NAME --docker
RUN find . -name "node_modules" -type d -prune -exec rm -rf '{}' +

FROM node:18-bookworm-slim AS base
FROM node:20-bookworm-slim AS base
RUN apt-get update && apt-get install -y openssl
RUN corepack enable
WORKDIR /app
Expand Down
2 changes: 1 addition & 1 deletion apps/remix-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,6 @@
"vitest": "^1.6.0"
},
"engines": {
"node": "18"
"node": "20"
}
}
2 changes: 1 addition & 1 deletion apps/remix-vercel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@
"vite-tsconfig-paths": "^4.3.2"
},
"engines": {
"node": "18"
"node": "20"
}
}
116 changes: 40 additions & 76 deletions turbo/generators/templates/Dockerfile.hbs
Original file line number Diff line number Diff line change
@@ -1,93 +1,57 @@
# This file is moved to the root directory before building the image
# This file is moved to the root directory before building the image ARG
APP_DIRNAME={{appDirname}}
ARG APP_PKG_NAME={{appPckgName}}

ARG APP_DIRNAME={{ appDirname }}
ARG APP_PKG_NAME={{ appPckgName }}

FROM node:18-bookworm-slim AS pruner
ARG APP_PKG_NAME
FROM node:20-bookworm-slim AS pruner ARG APP_PKG_NAME
{{#ifEquals dbType "sqlite-litefs"}}
RUN apt-get update && apt-get install -y openssl fuse3 sqlite3 ca-certificates
RUN apt-get update && apt-get install -y openssl fuse3 sqlite3 ca-certificates
{{else}}
RUN apt-get update && apt-get install -y openssl
RUN apt-get update && apt-get install -y openssl
{{/ifEquals}}
WORKDIR /app
RUN yarn global add turbo
COPY . .
RUN turbo prune --scope=$APP_PKG_NAME --docker
RUN find . -name "node_modules" -type d -prune -exec rm -rf '{}' +

FROM node:18-bookworm-slim AS base
WORKDIR /app RUN yarn global add turbo COPY . . RUN turbo prune
--scope=$APP_PKG_NAME --docker RUN find . -name "node_modules" -type d -prune
-exec rm -rf '{}' + FROM node:20-bookworm-slim AS base
{{#ifEquals dbType "sqlite-litefs"}}
RUN apt-get update && apt-get install -y openssl fuse3 sqlite3 ca-certificates
RUN apt-get update && apt-get install -y openssl fuse3 sqlite3 ca-certificates
{{else}}
RUN apt-get update && apt-get install -y openssl
RUN apt-get update && apt-get install -y openssl
{{/ifEquals}}
RUN corepack enable
WORKDIR /app
COPY .gitignore .gitignore
COPY --from=pruner /app/out/json/ .
COPY --from=pruner /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
COPY --from=pruner /app/out/pnpm-workspace.yaml ./pnpm-workspace.yaml

FROM base AS dev-deps
WORKDIR /app
RUN pnpm install

FROM base AS production-deps
WORKDIR /app
ENV NODE_ENV production
RUN pnpm install --prod
COPY --from=pruner /app/out/full/packages/database/prisma/schema.prisma /app/packages/database/prisma/schema.prisma
RUN pnpm dlx prisma generate --schema /app/packages/database/prisma/schema.prisma

FROM base AS builder
ARG APP_PKG_NAME
WORKDIR /app
RUN corepack enable
ENV NODE_ENV production
COPY --from=pruner /app/out/full/ .
COPY --from=dev-deps /app/ .
COPY turbo.json turbo.json
RUN pnpm run generate
RUN pnpm run build --filter=$APP_PKG_NAME...


# Runner
FROM base AS runner
ARG APP_DIRNAME

ENV NODE_ENV production
RUN corepack enable WORKDIR /app COPY .gitignore .gitignore COPY --from=pruner
/app/out/json/ . COPY --from=pruner /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
COPY --from=pruner /app/out/pnpm-workspace.yaml ./pnpm-workspace.yaml FROM base
AS dev-deps WORKDIR /app RUN pnpm install FROM base AS production-deps WORKDIR
/app ENV NODE_ENV production RUN pnpm install --prod COPY --from=pruner
/app/out/full/packages/database/prisma/schema.prisma
/app/packages/database/prisma/schema.prisma RUN pnpm dlx prisma generate
--schema /app/packages/database/prisma/schema.prisma FROM base AS builder ARG
APP_PKG_NAME WORKDIR /app RUN corepack enable ENV NODE_ENV production COPY
--from=pruner /app/out/full/ . COPY --from=dev-deps /app/ . COPY turbo.json
turbo.json RUN pnpm run generate RUN pnpm run build --filter=$APP_PKG_NAME... #
Runner FROM base AS runner ARG APP_DIRNAME ENV NODE_ENV production

{{#ifEquals dbType "sqlite-litefs"}}

ENV FLY="true"
ENV LITEFS_DIR="/litefs/data"
ENV DATABASE_FILENAME="sqlite.db"
ENV DATABASE_PATH="$LITEFS_DIR/$DATABASE_FILENAME"
ENV DATABASE_URL="file:$DATABASE_PATH"

# add shortcut for connecting to database CLI
RUN echo "#!/bin/sh\nset -x\nsqlite3 \$DATABASE_URL" > /usr/local/bin/database-cli && chmod +x /usr/local/bin/database-cli
ENV FLY="true" ENV LITEFS_DIR="/litefs/data" ENV DATABASE_FILENAME="sqlite.db"
ENV DATABASE_PATH="$LITEFS_DIR/$DATABASE_FILENAME" ENV
DATABASE_URL="file:$DATABASE_PATH" # add shortcut for connecting to database
CLI RUN echo "#!/bin/sh\nset -x\nsqlite3 \$DATABASE_URL" >
/usr/local/bin/database-cli && chmod +x /usr/local/bin/database-cli

{{/ifEquals}}

COPY --from=pruner /app/out/full/ .
COPY --from=production-deps /app .
COPY --from=builder /app/apps/$APP_DIRNAME/index.js ./apps/$APP_DIRNAME/index.js
COPY --from=builder /app/apps/$APP_DIRNAME/build ./apps/$APP_DIRNAME/build
COPY --from=builder /app/apps/$APP_DIRNAME/public ./apps/$APP_DIRNAME/public
COPY --from=builder /app/apps/$APP_DIRNAME/server-build ./apps/$APP_DIRNAME/server-build
COPY --from=pruner /app/out/full/ . COPY --from=production-deps /app . COPY
--from=builder /app/apps/$APP_DIRNAME/index.js ./apps/$APP_DIRNAME/index.js COPY
--from=builder /app/apps/$APP_DIRNAME/build ./apps/$APP_DIRNAME/build COPY
--from=builder /app/apps/$APP_DIRNAME/public ./apps/$APP_DIRNAME/public COPY
--from=builder /app/apps/$APP_DIRNAME/server-build
./apps/$APP_DIRNAME/server-build

{{#ifEquals dbType "sqlite-litefs"}}
# prepare for litefs
COPY --from=flyio/litefs:0.5 /usr/local/bin/litefs /usr/local/bin/litefs
ADD ./apps/$APP_DIRNAME/other/litefs.yml /etc/litefs.yml
RUN mkdir -p /data ${LITEFS_DIR}

ADD . .

CMD ["litefs", "mount"]
# prepare for litefs COPY --from=flyio/litefs:0.5 /usr/local/bin/litefs
/usr/local/bin/litefs ADD ./apps/$APP_DIRNAME/other/litefs.yml /etc/litefs.yml
RUN mkdir -p /data ${LITEFS_DIR} ADD . . CMD ["litefs", "mount"]
{{else}}
# release_command = "pnpx prisma migrate deploy --schema packages/database/prisma/schema.prisma"
CMD ["pnpm", "run", "start-remix-production"]
# release_command = "pnpx prisma migrate deploy --schema
packages/database/prisma/schema.prisma" CMD ["pnpm", "run",
"start-remix-production"]
{{/ifEquals}}
8 changes: 4 additions & 4 deletions turbo/generators/templates/deploy-with-litefs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: ⎔ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: "pnpm"

- name: 📥 Download deps
Expand All @@ -55,7 +55,7 @@ jobs:
- name: ⎔ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: "pnpm"

- name: 📥 Download deps
Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:
- name: ⎔ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: "pnpm"

- name: 📥 Download deps
Expand Down Expand Up @@ -122,7 +122,7 @@ jobs:
- name: ⎔ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: "pnpm"

- name: 🏄 Copy test env vars
Expand Down
8 changes: 4 additions & 4 deletions turbo/generators/templates/deploy-with-postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: ⎔ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: "pnpm"

- name: 📥 Download deps
Expand All @@ -55,7 +55,7 @@ jobs:
- name: ⎔ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: "pnpm"

- name: 📥 Download deps
Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:
- name: ⎔ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: "pnpm"

- name: 📥 Download deps
Expand Down Expand Up @@ -122,7 +122,7 @@ jobs:
- name: ⎔ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: "pnpm"

- name: 🏄 Copy test env vars
Expand Down