generated from jkomyno/pnpm-monorepo-example
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: reproduced issue prisma/prisma#14043
- Loading branch information
Showing
14 changed files
with
664 additions
and
462 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
**/node_modules | ||
**/lib | ||
**/coverage | ||
**/*.env | ||
**/*.env.example | ||
**/Dockerfile* | ||
.gitattributes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
enable-pre-post-scripts=true | ||
unsafe-perm=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,34 @@ | ||
ARG DOCKER_BASE_IMAGE="alpine" | ||
ARG NODE_VERSION="18.0.0" | ||
ARG PNPM_VERSION="6.32.3" | ||
|
||
FROM node:${NODE_VERSION}-alpine as base-alpine | ||
ENV IS_ALPINE=TRUE | ||
ENV INSTALL_CMD="apk add --no-cache --upgrade git grep openssl openssl-dev gcompat libc6-compat" | ||
|
||
FROM node:${NODE_VERSION}-slim as base-slim | ||
ENV IS_ALPINE=FALSE | ||
ENV INSTALL_CMD="apt-get update -y && \ | ||
apt-get install -y --upgrade git grep openssl" | ||
|
||
## | ||
# Create base image with pnpm installed | ||
## | ||
|
||
FROM node:${NODE_VERSION}-alpine as jkomyno-pnpm | ||
FROM base-${DOCKER_BASE_IMAGE} as jkomyno-pnpm | ||
LABEL jkomyno/pnpm-monorepo-example.name=pnpm | ||
|
||
RUN apk add git | ||
RUN apk add --no-cache --upgrade grep | ||
# for alpine | ||
RUN eval $INSTALL_CMD | ||
|
||
RUN --mount=type=cache,id=pnpm-store,target=/root/.pnpm-store \ | ||
npm i -g pnpm@${PNPM_VERSION} | ||
|
||
WORKDIR /app | ||
|
||
COPY ["./*.json", "./*.yaml", "./"] | ||
|
||
# enable pre/post hooks | ||
COPY ["./.npmrc", "./.npmrc"] | ||
|
||
RUN mkdir ./packages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
# Keep environment variables out of version control | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
## | ||
# Install dependencies, generate Prisma client, transpile TypeScript to JavaScript, | ||
# run unit tests, delete node_modules and source files | ||
## | ||
|
||
FROM jkomyno-pnpm AS builder | ||
LABEL jkomyno/reproduce-issue-14043.name=example | ||
LABEL jkomyno/reproduce-issue-14043.intermediate=true | ||
|
||
WORKDIR /app/packages | ||
|
||
# add test config | ||
COPY ["./jest/", "./jest/"] | ||
|
||
# add local dependency source | ||
COPY ["./common-utils/", "./common-utils/"] | ||
|
||
# add package itself | ||
COPY ["./example/", "./example/"] | ||
|
||
WORKDIR /app | ||
|
||
# install | ||
RUN --mount=type=cache,id=pnpm-store,target=/root/.pnpm-store \ | ||
pnpm install --frozen-lockfile \ | ||
| grep -v "cross-device link not permitted\|Falling back to copying packages from store" | ||
|
||
RUN pnpm --filter "example" postinstall | ||
RUN pnpm build | ||
RUN pnpm --filter "example" test:unit | ||
RUN rm -rf node_modules \ | ||
&& pnpm -r exec -- rm -rf node_modules src __tests__ jest | ||
|
||
## | ||
# Copy production dependencies and transpiled bundle, start application | ||
## | ||
|
||
FROM jkomyno-pnpm AS example | ||
LABEL jkomyno/reproduce-issue-14043.name=example | ||
LABEL jkomyno/reproduce-issue-14043.intermediate=false | ||
WORKDIR /app | ||
|
||
ENV NODE_ENV=production | ||
|
||
COPY --from=builder /app . | ||
RUN --mount=type=cache,id=pnpm-store,target=/root/.pnpm-store \ | ||
pnpm install --frozen-lockfile --prod \ | ||
| grep -v "cross-device link not permitted\|Falling back to copying packages from store" | ||
|
||
WORKDIR /app/packages/example | ||
|
||
# generate Prisma client | ||
RUN pnpx prisma generate | ||
|
||
ENTRYPOINT ["node", "lib"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// This is your Prisma schema file, | ||
// learn more about it in the docs: https://pris.ly/d/prisma-schema | ||
|
||
generator client { | ||
provider = "prisma-client-js" | ||
output = "../node_modules/.prisma/client" | ||
} | ||
|
||
datasource db { | ||
provider = "postgresql" | ||
url = env("DATABASE_URL") | ||
} | ||
|
||
enum LogSeverity { | ||
error | ||
info | ||
warn | ||
} | ||
|
||
model Log { | ||
id String @id @default(uuid()) | ||
app String | ||
timestamp Int | ||
text String | ||
severity LogSeverity @default(info) | ||
created_at DateTime @db.Timestamptz(6) @default(now()) | ||
updated_at DateTime @db.Timestamptz(6) @default(now()) @updatedAt | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.