Skip to content

Commit

Permalink
feat: docker
Browse files Browse the repository at this point in the history
  • Loading branch information
Faizal Andyka committed Jul 16, 2021
1 parent 3e7b863 commit 1858802
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 9 deletions.
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
coverage
dist
node_modules
.dockerignore
.editorconfig
.gitignore
.github
.git
*.md
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Stage Base
FROM node:14.17.1-alpine as base
RUN npm install pnpm --global
WORKDIR /app

# Stage Build
FROM base as build
COPY . .
RUN pnpm install
RUN pnpm build:prod

# Stage Webserver
FROM nginx:stable-alpine as webserver
COPY --from=build /app/nginx/nginx.prod.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
2 changes: 1 addition & 1 deletion nginx/nginx.dev.conf
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ server {
expires 7d;
add_header Cache-Control "no-cache, public, must-revalidate, proxy-revalidate";
}
}
}
2 changes: 1 addition & 1 deletion nginx/nginx.prod.conf
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ server {
expires 7d;
add_header Cache-Control "no-cache, public, must-revalidate, proxy-revalidate";
}
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.3.1",
"eslint-plugin-vue": "^7.9.0",
"husky": "^6.0.0",
"shelljs": "^0.8.4",
"standard": "^16.0.3",
"stylelint": "^13.13.1",
Expand All @@ -82,6 +81,7 @@
"camelcase": "^6.2.0",
"dotenv-cli": "^4.0.0",
"element-plus": "^1.0.2-beta.44",
"husky": "^7.0.0",
"postcss": "^8.2.15",
"postcss-import": "^14.0.2",
"rimraf": "^3.0.2",
Expand Down
11 changes: 6 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Learn the design patterns [here](https://github.com/logustra/7ad)
- Linters: [commitlint](https://github.com/conventional-changelog/commitlint), [eslint](https://github.com/eslint/eslint), [stylelint](https://github.com/stylelint/stylelint)
- Visualize bundle: [rollup-plugin-visualizer](https://github.com/btd/rollup-plugin-visualizer)
- Optimized nginx config
- Dockerize (ON PROGRESS)
- Dockerize

## Dev Tools
- [Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar): Vue 3 IDE support
Expand Down Expand Up @@ -83,6 +83,16 @@ $ pnpm install
$ pnpm dev
```

## Run with Docker

```bash
# build docker image and tag it with name nginx
$ docker build . -t nginx

# run docker image nginx with name vivu in port 9900
$ docker run -it -p 9900:80 --rm --name vivu nginx
```

## How to Create Folder
A guide how to create a folder using `create-cli`

Expand Down

0 comments on commit 1858802

Please sign in to comment.