Skip to content

Commit 563b75d

Browse files
committed
chore: Add docker setup for client localhost development
1 parent 77550c0 commit 563b75d

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,20 @@ The following dependecies are used for this project. Feel free to experiment usi
2727

2828
2. Follow the instructions on the README files inside the `/client` directory for more information on configuring and using the NextJS client app.
2929

30+
## Quick Usage Guide
31+
32+
### Manual Installation and Usage
33+
34+
1. Navigate to the **/client** directory from the commandline.
35+
2. Run: `npm run install`
36+
3. Run: `npm run dev`
37+
38+
### Localhost Development Using Docker
39+
40+
> **NOTE:** Requires Docker installed on the development machine.
41+
42+
1. Navogate the the repository's root directory from the commandline.
43+
2. Run: `docker compose up`
44+
3045
@weaponsforge<br>
3146
20230319

client/Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM node:18.14.2-alpine as base
2+
RUN mkdir -p /opt/client
3+
WORKDIR /opt/client
4+
RUN adduser -S client
5+
RUN chown -R client /opt/client
6+
COPY package*.json ./
7+
8+
# DEVELOPMENT CLIENT PROFILE
9+
FROM base as development
10+
ENV NODE_ENV=development
11+
RUN npm install && npm cache clean --force
12+
COPY . ./
13+
EXPOSE 3000
14+
CMD ["npm", "run", "dev"]

docker-compose.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
version: "3"
2+
services:
3+
# NextJS v13 app running on development mode
4+
react-hooks-playground-client-dev:
5+
container_name: react-hooks-playground-client-dev
6+
image: weaponsforge/react-hooks-playground-client:dev
7+
build:
8+
context: ./client
9+
dockerfile: Dockerfile
10+
target: development
11+
networks:
12+
- react-hooks-playground-dev
13+
volumes:
14+
- ./client:/opt/client
15+
- /opt/client/node_modules
16+
- /opt/client/.next
17+
ports:
18+
- "3000:3000"
19+
20+
networks:
21+
react-hooks-playground-dev:
22+
name: react-hooks-playground-dev
23+
external: false

0 commit comments

Comments
 (0)