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

Add examples/with-docker-pnpm sample of using pnpm and docker #5536

Closed
wants to merge 16 commits into from

Conversation

nicu-chiciuc
Copy link

@nicu-chiciuc nicu-chiciuc commented Jul 15, 2023

Description

Based on:

This PR adds a new example of using docker pnpm.

I've tried to keep the project code and structure similar to the existing examples/with-docker project with some updated goals:

  • The api app is strongly typed, but uses standard ESM instead of relying on a build step. Additional type information can be added using JsDoc.
  • The Dockerfile might not make the best performance decision (I assume), but I've kept it simple enough so that I could understand it. Initially I didn't even use the node alpine version, but switched to it afterwards.
  • I've removed most next config configurations and left just these:
export default {
  reactStrictMode: true,
  experimental: {
    appDir: true,
  },
};

I've also installed syncpack to check if there are any mismatches. I've added a package.json script for it, and it can be ran like this:

pnpm run syncpack

Unfortunately it also show errors for the local dependencies: JamieMason/syncpack#121

but it will also show other mismatches, so I could pretty easily fix those.

Testing Instructions

I've personally tested this by

  1. cloning the repo
  2. cd into ./examples/with-docker-pnpm
  3. Follow the instruction in the readme (pnpm install)

The previous step may not work by default (it didn't for me) because the root package.json has this:

  "engines": {
    "node": "18.x",
    "pnpm": "7"
  }

And my local pnpm was 8.6.5.
While writing this PR I just removed that requirement for pnpm.

This doesn't seem like a nice solution.

A simpler solution would be to copy the with-docker-pnpm folder into a different folder and follow the instruction in the README. This seems like a better solution since this is how a potential user would use the example.

After copying the folder, run:

pnpm install
pnpm run dev

and/or

docker compose build
docker compose up

both methods should work.

@turbo-orchestrator turbo-orchestrator bot added area: examples Improvements or additions to examples team: turborepo labels Jul 15, 2023
@vercel
Copy link

vercel bot commented Jul 15, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-designsystem-docs 🔄 Building (Inspect) Visit Preview 💬 Add feedback Jul 15, 2023 10:17am
examples-native-web 🔄 Building (Inspect) Visit Preview 💬 Add feedback Jul 15, 2023 10:17am
7 Ignored Deployments
Name Status Preview Comments Updated (UTC)
examples-basic-web ⬜️ Ignored (Inspect) Visit Preview Jul 15, 2023 10:17am
examples-cra-web ⬜️ Ignored (Inspect) Visit Preview Jul 15, 2023 10:17am
examples-gatsby-web ⬜️ Ignored (Inspect) Visit Preview Jul 15, 2023 10:17am
examples-kitchensink-blog ⬜️ Ignored (Inspect) Visit Preview Jul 15, 2023 10:17am
examples-svelte-web ⬜️ Ignored (Inspect) Visit Preview Jul 15, 2023 10:17am
examples-tailwind-web ⬜️ Ignored (Inspect) Visit Preview Jul 15, 2023 10:17am
examples-vite-web ⬜️ Ignored (Inspect) Visit Preview Jul 15, 2023 10:17am

@vercel
Copy link

vercel bot commented Jul 15, 2023

@nicu-chiciuc is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

@nicu-chiciuc nicu-chiciuc marked this pull request as ready for review July 15, 2023 10:20
@nicu-chiciuc nicu-chiciuc requested a review from a team as a code owner July 15, 2023 10:20
@eugenejeonme
Copy link

I'm building this way too, and it's a bit frustrating.
Does you know how to build with the 'standalone' option?

@JamieMason
Copy link

Unfortunately it also show errors for the local dependencies: JamieMason/syncpack#121

@nicu-chiciuc there's a good chance you'll need to add some configuration to get what you need. I added an example in this comment but your scenario might be slightly different, I don't know yet, feel free to open an issue where I can try and help work it out with you.

@nicu-chiciuc
Copy link
Author

I will close this branch for now. I think it may serve as a good starter example for someone, even if it's not merged in the official package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: examples Improvements or additions to examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants