Skip to content

Commit e85d962

Browse files
committed
Implementing Docker
1 parent c01937f commit e85d962

File tree

4 files changed

+40
-6
lines changed

4 files changed

+40
-6
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
npm-debug*
3+
.nuxt

Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM node:14.16
2+
3+
WORKDIR /var/www
4+
5+
COPY . /var/www
6+
7+
RUN npm install \
8+
&& npm run build
9+
10+
EXPOSE 3000
11+
12+
CMD [ "npm", "run", "start" ]

README.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,31 @@
66

77
## Build Setup
88

9-
```bash
9+
```shell
1010
# install dependencies
1111
$ npm install # Or yarn install
1212

13-
# install babel 7 (optional)
14-
$ npm install --save-dev @babel/core @babel/preset-env
15-
1613
# serve with hot reload at localhost:3000
1714
$ npm run dev
15+
```
16+
Open http://localhost:3000
1817

18+
## Production
19+
```shell
1920
# build for production and launch server
2021
$ npm run build
2122
$ npm start
2223

23-
# generate static project
24-
$ npm run generate
24+
# or generate static project
25+
# npm run generate
26+
```
27+
28+
## Docker
29+
```shell
30+
$ docker build -t nuxt_dashboard .
31+
$ docker run -it -e HOST=0.0.0.0 -p 3000:3000 nuxt_dashboard
2532
```
33+
Open http://`docker-machine ip`:3000
2634

2735
For detailed explanation on how things work, check out:
2836
- [Material-dashboard](https://demos.creative-tim.com/material-dashboard/docs/2.1/getting-started/introduction.html) documentation

docker-compose.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: '3'
2+
services:
3+
nuxt:
4+
build: '.'
5+
restart: always
6+
ports:
7+
- 3000:3000
8+
environment:
9+
- HOST=0.0.0.0
10+
- PORT=3000
11+
command: 'npm run start'

0 commit comments

Comments
 (0)