diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..854ebfa --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +.git +.github +.gitignore +.dockerignore +.vercel +node_modules +npm-debug.log +Dockerfile diff --git a/README.md b/README.md index 428ae06..1e9c464 100644 --- a/README.md +++ b/README.md @@ -27,5 +27,27 @@ The following dependecies are used for this project. Feel free to experiment usi 2. Follow the instructions on the README files inside the `/client` directory for more information on configuring and using the NextJS client app. +## Quick Usage Guide + +### Manual Installation and Usage + +1. Navigate to the **/client** directory from the commandline. +2. Run: `npm run install` +3. Run: `npm run dev` + +### Localhost Development Using Docker + +> **NOTE:** Requires Docker installed on the development machine. + +1. Navigate the the repository's root directory from the commandline. +2. Run the docker compose commands:
+ ``` + # Build the image + docker compose build + + # Start/stop the docker image + docker compose up/down + ``` + @weaponsforge
20230319 diff --git a/client/.dockerignore b/client/.dockerignore new file mode 100644 index 0000000..ca47e9a --- /dev/null +++ b/client/.dockerignore @@ -0,0 +1,6 @@ +.git +.gitignore +.dockerignore +node_modules +npm-debug.log +Dockerfile diff --git a/client/.eslintignore b/client/.eslintignore new file mode 100644 index 0000000..55175ef --- /dev/null +++ b/client/.eslintignore @@ -0,0 +1,32 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# next.js +/.next/ +/out/ + +# production +/build + +# misc +.DS_Store +*.pem + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* +.pnpm-debug.log* + +# local env files +.env*.local + +# vercel +.vercel diff --git a/client/Dockerfile b/client/Dockerfile new file mode 100644 index 0000000..8724c29 --- /dev/null +++ b/client/Dockerfile @@ -0,0 +1,14 @@ +FROM node:18.14.2-alpine as base +RUN mkdir -p /opt/client +WORKDIR /opt/client +RUN adduser -S client +RUN chown -R client /opt/client +COPY package*.json ./ + +# DEVELOPMENT CLIENT PROFILE +FROM base as development +ENV NODE_ENV=development +RUN npm install && npm cache clean --force +COPY . ./ +EXPOSE 3000 +CMD ["npm", "run", "dev"] diff --git a/client/README.md b/client/README.md index b4e5754..63426da 100644 --- a/client/README.md +++ b/client/README.md @@ -34,6 +34,9 @@ http://localhost:3000 ### `npm run lint` Check for lint errors. +### npm run lint:fix +Fix lint errors. + ### `npm run export` Export the static website. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..1f48c74 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,23 @@ +version: "3" +services: + # NextJS v13 app running on development mode + react-hooks-playground-client-dev: + container_name: react-hooks-playground-client-dev + image: weaponsforge/react-hooks-playground-client:dev + build: + context: ./client + dockerfile: Dockerfile + target: development + networks: + - react-hooks-playground-dev + volumes: + - ./client:/opt/client + - /opt/client/node_modules + - /opt/client/.next + ports: + - "3000:3000" + +networks: + react-hooks-playground-dev: + name: react-hooks-playground-dev + external: false