Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
# nextjs-nodejs-example
Example Project on how to develop and build NEXT.js with NodeJS Backend

# run on docker

This will build both docker images and run container using default network
```
$ docker-compose up -d --build
```
11 changes: 11 additions & 0 deletions api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM node:10

WORKDIR /usr/src/app/api

COPY package*.json ./

RUN npm install

EXPOSE 3080

CMD ["npm", "run", "dev"]
21 changes: 21 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: '3'
services:
nodejs-server:
build:
context: ./api
ports:
- "3080:3080"
container_name: node-api
volumes:
- ./api:/usr/src/app/api
- /usr/src/app/api/node_modules
nextjs-ui:
build:
context: ./my-app
ports:
- "3000:3000"
container_name: nextjs-ui
stdin_open: true
volumes:
- ./my-app:/usr/src/app/my-app
- /usr/src/app/my-app/node_modules
11 changes: 11 additions & 0 deletions my-app/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM node:10

WORKDIR /usr/src/app/my-app

COPY package*.json ./

RUN npm install

EXPOSE 3000

CMD ["npm", "run", "start:dev"]