diff --git a/.dockerignore b/.dockerignore index 076405933..b3204ffac 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,27 +1,2 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules -/.pnp -.pnp.js -*.swp - -# testing -/coverage - -# production -/build - -# misc -.DS_Store -.vscode -.idea -.env -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* +**/node_modules +**/build diff --git a/.gitignore b/.gitignore index ce76aad3d..502f6fbed 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # dependencies -/node_modules +**/node_modules /.pnp .pnp.js package-lock.json @@ -11,7 +11,7 @@ package-lock.json /coverage # production -/build +**/build # misc .DS_Store diff --git a/.npmrc b/.npmrc new file mode 100644 index 000000000..d67f37488 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +node-linker=hoisted diff --git a/Dockerfile b/Dockerfile index 402bf5c5b..783d8f6fa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,17 +12,23 @@ RUN apt-get -qq update; \ nvm use --delete-prefix default ENV PATH /root/.nvm/versions/node/$NODE_VERSION/bin:$PATH +# Install base dependencies +RUN npm install --global pnpm@8.6.6 serve@14.1.2 react-inject-env@2.1.0 + +# Copy lockfile and prefetch depdendencies +COPY pnpm-lock.yaml . +RUN pnpm fetch + # Copy repository COPY . . -# Install requirements -RUN npm install --global pnpm@8.6.6 serve@14.1.2; \ - pnpm install; \ - pnpm install react-inject-env@2.1.0 --save - # Build -RUN pnpm run build; \ - chmod 711 /root +RUN pnpm --filter @taxi/web... install --offline; \ + pnpm --filter @taxi/web... build + +# Move built files to root +RUN mv /root/packages/web/build . +RUN chmod 711 /root # Set default environment variables ENV REACT_APP_BACK_URL=https://taxi.sparcs.org/api \ diff --git a/README.md b/README.md index cca0ffc85..43277bda2 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,32 @@ $ pnpm install See [notion page](https://www.notion.so/sparcs/Environment-Variables-1b404bd385fa495bac6d5517b57d72bf). Refer to [.env.example](.env.example) and write your own `.env`. + +## Development + +Run scoped scripts + +```bash +pnpm