Skip to content

Commit 2630abb

Browse files
author
Sebastian Boolean
committed
adding generator and templates
1 parent 6be6bc8 commit 2630abb

File tree

6 files changed

+46
-0
lines changed

6 files changed

+46
-0
lines changed

README.md

Whitespace-only changes.

generator.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module.exports = api => {
2+
api.extendPackage({
3+
scripts: {
4+
'docker': 'docker build . -t app && docker run -d -p 8080:8080 app'
5+
}
6+
})
7+
api.render('./template')
8+
}

index.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = api => {
2+
//nothing to do here
3+
};

template/.dockerignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
node_modules
2+
npm-debug.log
3+
Dockerfile*
4+
docker-compose*
5+
.dockerignore
6+
.git
7+
.gitignore
8+
README.md
9+
dist

template/Dockerfile

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM node:alpine
2+
RUN mkdir -p /usr/src/app
3+
WORKDIR /usr/src/app
4+
COPY ["package.json", "package-lock.json", "/usr/src/app/"]
5+
RUN npm install
6+
COPY . /usr/src/app
7+
RUN npm run build
8+
9+
FROM nginx:alpine
10+
EXPOSE 80
11+
COPY default.conf /etc/nginx/conf.d/default.conf
12+
COPY --from=0 /usr/src/app/dist /usr/share/nginx/html

template/default.conf

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
server {
2+
listen 80;
3+
server_name localhost;
4+
location / {
5+
root /usr/share/nginx/html;
6+
index index.html;
7+
try_files $uri $uri/ /index.html;
8+
}
9+
10+
error_page 500 502 503 504 /50x.html;
11+
location = /50x.html {
12+
root /usr/share/nginx/html;
13+
}
14+
}

0 commit comments

Comments
 (0)