Skip to content
This repository was archived by the owner on Apr 1, 2021. It is now read-only.

Commit be40644

Browse files
committed
Merge branch 'feature/deploy-script' into develop
2 parents 4c3602d + 90d5b4a commit be40644

File tree

11 files changed

+414
-5
lines changed

11 files changed

+414
-5
lines changed

.dockerignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/node_modules
2+
/public/hot
3+
/storage/*.key
4+
/vendor
5+
/.idea
6+
/.vscode
7+
/.vagrant
8+
Dockerfile
9+
Homestead.json
10+
Homestead.yaml
11+
npm-debug.log
12+
yarn-error.log
13+
.DS_Store

Dockerfile

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
FROM node:8 AS compiler
2+
3+
LABEL maintainer="Ade Novid <adenvt@gmail.com>"
4+
5+
WORKDIR /var/www
6+
COPY package.json /var/www
7+
COPY package-lock.json /var/www
8+
RUN npm ci
9+
10+
COPY . /var/www
11+
RUN npm run prod
12+
RUN rm -rf /var/www/node_modules/
13+
14+
FROM php:7.2-fpm AS server
15+
RUN set -x \
16+
&& apt-get update -y \
17+
&& apt-get install --no-install-recommends --no-install-suggests -y \
18+
nginx \
19+
nginx-extras \
20+
curl \
21+
git \
22+
unzip \
23+
zlib1g-dev \
24+
&& apt-get clean
25+
RUN docker-php-ext-install zip
26+
27+
WORKDIR /var/www
28+
29+
ENV TZ=Asia/Jakarta
30+
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
31+
32+
ENV COMPOSER_ALLOW_SUPERUSER=1
33+
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
34+
COPY composer.json composer.json
35+
COPY composer.lock composer.lock
36+
RUN composer config -g repos.packagist composer https://packagist.jp
37+
RUN composer global require hirak/prestissimo
38+
RUN composer install --prefer-dist --no-scripts --no-dev --no-autoloader && rm -rf /root/.composer
39+
40+
COPY deploy/web/site.conf /etc/nginx/sites-available/default
41+
COPY deploy/web/nginx.conf /etc/nginx/nginx.conf
42+
COPY deploy/web/mime.types /etc/nginx/mime.types
43+
COPY deploy/web/php.ini /usr/local/etc/php/
44+
COPY --from=compiler /var/www /var/www
45+
46+
RUN composer dump-autoload --no-scripts --no-dev --optimize
47+
RUN chown -R www-data:www-data /var/www
48+
RUN rm -rf /var/www/html/ /var/www/deploy/
49+
50+
EXPOSE 80 443
51+
52+
CMD service nginx start && php-fpm

README.md

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,14 @@
33
> Laravel + CoreUI + Vue Boilerplate
44
55
[![GitHub version](https://badge.fury.io/gh/adenvt%2Flaravel-coreui-vue.svg)](https://badge.fury.io/gh/adenvt%2Flaravel-coreui-vue)
6-
[![Greenkeeper badge](https://badges.greenkeeper.io/adenvt/laravel-coreui-vue.svg)](https://greenkeeper.io/)
7-
86
## What's inside
97
* [Laravel][laravel] 5.6, A PHP framework for web artisans
108
* [Core UI][coreui] for Vue, Free Bootstrap Admin Template
119
* Usefull library: [Axios][axios], [jQuery][jquery], [Moment.js][moment], [Lodash][lodash]
1210
* [Vue Router][vue-router] and [Vuex][vuex], set out of the box
1311
* Notification using [Vue-SweatAlert2][vue-sweatalert2] and [Vue-Notification][vue-notification]
1412
* Loading spinner with [Vue Loading Spinner][vue-loading-spinner]
15-
* Quick deployment with [Docker Compose][docker-compose] [TODO]
13+
* Quick deployment with [Docker Compose][docker-compose]
1614

1715
## Requirement
1816
* **PHP** >= 7.1.3
@@ -50,10 +48,51 @@ npm run dev
5048
## for Production
5149
npm run prod
5250

53-
### for Development with HMR (Hot Module Replacement)
51+
## for Development with HMR (Hot Module Replacement)
5452
npm run hot
5553
```
5654

55+
## Using Docker Compose
56+
57+
### For Development
58+
59+
* Create and run Container
60+
```bash
61+
docker-compose up -d dev
62+
```
63+
64+
* Enter workspace
65+
```bash
66+
docker-compose exec dev bash
67+
```
68+
69+
* Install Depencies
70+
```
71+
composer install
72+
npm install
73+
```
74+
* Compile Static Asset
75+
```bash
76+
## Single run compile
77+
npm run dev
78+
79+
## or watch and compile every change
80+
npm run watch
81+
82+
## or using Hot Module Replacement
83+
npm run hot
84+
```
85+
* Open browser, goto `http://localhost:8080`
86+
87+
### For Production
88+
* Create and run Container
89+
```
90+
docker-compose up -d prod
91+
```
92+
* Open browser, goto `http://localhost:8888`
93+
94+
95+
5796
## License
5897
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details
5998

deploy/dev/Dockerfile

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
FROM php:7.2-fpm
2+
3+
LABEL maintainer="Ade Novid <adenvt@gmail.com>"
4+
5+
WORKDIR /var/www
6+
7+
RUN set -x \
8+
&& apt-get update -y \
9+
&& apt-get install --no-install-recommends --no-install-suggests -y \
10+
nginx \
11+
nginx-extras \
12+
curl \
13+
git \
14+
unzip \
15+
zlib1g-dev \
16+
gnupg
17+
18+
# Install Node
19+
RUN curl --silent --location https://deb.nodesource.com/setup_8.x | bash -
20+
RUN apt-get install --no-install-recommends --no-install-suggests -y \
21+
nodejs
22+
23+
# Install PHP Plugin
24+
RUN docker-php-ext-install zip
25+
26+
ENV TZ=Asia/Jakarta
27+
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
28+
29+
# Install Composer
30+
ENV COMPOSER_ALLOW_SUPERUSER=1
31+
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
32+
RUN composer global require hirak/prestissimo
33+
34+
# Configuring NGINX
35+
COPY deploy/web/site.conf /etc/nginx/sites-available/default
36+
COPY deploy/web/nginx.conf /etc/nginx/nginx.conf
37+
COPY deploy/web/mime.types /etc/nginx/mime.types
38+
COPY deploy/web/php.ini /usr/local/etc/php/
39+
40+
RUN rm -rf /var/www/html/
41+
42+
EXPOSE 80 443 8080
43+
44+
CMD service nginx start && php-fpm

deploy/web/mime.types

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
types {
2+
3+
# Data interchange
4+
5+
application/atom+xml atom;
6+
application/json json map topojson;
7+
application/ld+json jsonld;
8+
application/rss+xml rss;
9+
application/vnd.geo+json geojson;
10+
application/xml rdf xml;
11+
12+
13+
# JavaScript
14+
15+
# Normalize to standard type.
16+
# https://tools.ietf.org/html/rfc4329#section-7.2
17+
application/javascript js;
18+
19+
20+
# Manifest files
21+
22+
application/manifest+json webmanifest;
23+
application/x-web-app-manifest+json webapp;
24+
text/cache-manifest appcache;
25+
26+
27+
# Media files
28+
29+
audio/midi mid midi kar;
30+
audio/mp4 aac f4a f4b m4a;
31+
audio/mpeg mp3;
32+
audio/ogg oga ogg opus;
33+
audio/x-realaudio ra;
34+
audio/x-wav wav;
35+
image/bmp bmp;
36+
image/gif gif;
37+
image/jpeg jpeg jpg;
38+
image/jxr jxr hdp wdp;
39+
image/png png;
40+
image/svg+xml svg svgz;
41+
image/tiff tif tiff;
42+
image/vnd.wap.wbmp wbmp;
43+
image/webp webp;
44+
image/x-jng jng;
45+
video/3gpp 3gp 3gpp;
46+
video/mp4 f4p f4v m4v mp4;
47+
video/mpeg mpeg mpg;
48+
video/ogg ogv;
49+
video/quicktime mov;
50+
video/webm webm;
51+
video/x-flv flv;
52+
video/x-mng mng;
53+
video/x-ms-asf asf asx;
54+
video/x-ms-wmv wmv;
55+
video/x-msvideo avi;
56+
57+
# Serving `.ico` image files with a different media type
58+
# prevents Internet Explorer from displaying then as images:
59+
# https://github.com/h5bp/html5-boilerplate/commit/37b5fec090d00f38de64b591bcddcb205aadf8ee
60+
61+
image/x-icon cur ico;
62+
63+
64+
# Microsoft Office
65+
66+
application/msword doc;
67+
application/vnd.ms-excel xls;
68+
application/vnd.ms-powerpoint ppt;
69+
application/vnd.openxmlformats-officedocument.wordprocessingml.document docx;
70+
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx;
71+
application/vnd.openxmlformats-officedocument.presentationml.presentation pptx;
72+
73+
74+
# Web fonts
75+
76+
application/font-woff woff;
77+
application/font-woff2 woff2;
78+
application/vnd.ms-fontobject eot;
79+
80+
# Browsers usually ignore the font media types and simply sniff
81+
# the bytes to figure out the font type.
82+
# https://mimesniff.spec.whatwg.org/#matching-a-font-type-pattern
83+
#
84+
# However, Blink and WebKit based browsers will show a warning
85+
# in the console if the following font types are served with any
86+
# other media types.
87+
88+
application/x-font-ttf ttc ttf;
89+
font/opentype otf;
90+
91+
92+
# Other
93+
94+
application/java-archive ear jar war;
95+
application/mac-binhex40 hqx;
96+
application/octet-stream bin deb dll dmg exe img iso msi msm msp safariextz;
97+
application/pdf pdf;
98+
application/postscript ai eps ps;
99+
application/rtf rtf;
100+
application/vnd.google-earth.kml+xml kml;
101+
application/vnd.google-earth.kmz kmz;
102+
application/vnd.wap.wmlc wmlc;
103+
application/x-7z-compressed 7z;
104+
application/x-bb-appworld bbaw;
105+
application/x-bittorrent torrent;
106+
application/x-chrome-extension crx;
107+
application/x-cocoa cco;
108+
application/x-java-archive-diff jardiff;
109+
application/x-java-jnlp-file jnlp;
110+
application/x-makeself run;
111+
application/x-opera-extension oex;
112+
application/x-perl pl pm;
113+
application/x-pilot pdb prc;
114+
application/x-rar-compressed rar;
115+
application/x-redhat-package-manager rpm;
116+
application/x-sea sea;
117+
application/x-shockwave-flash swf;
118+
application/x-stuffit sit;
119+
application/x-tcl tcl tk;
120+
application/x-x509-ca-cert crt der pem;
121+
application/x-xpinstall xpi;
122+
application/xhtml+xml xhtml;
123+
application/xslt+xml xsl;
124+
application/zip zip;
125+
text/css css;
126+
text/csv csv;
127+
text/html htm html shtml;
128+
text/markdown md;
129+
text/mathml mml;
130+
text/plain txt;
131+
text/vcard vcard vcf;
132+
text/vnd.rim.location.xloc xloc;
133+
text/vnd.sun.j2me.app-descriptor jad;
134+
text/vnd.wap.wml wml;
135+
text/vtt vtt;
136+
text/x-component htc;
137+
138+
}

deploy/web/nginx.conf

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
user www-data;
2+
worker_processes auto;
3+
worker_rlimit_nofile 8192;
4+
5+
events {
6+
worker_connections 8000;
7+
}
8+
9+
pid /var/run/nginx.pid;
10+
11+
http {
12+
server_tokens off;
13+
include mime.types;
14+
default_type application/octet-stream;
15+
16+
charset_types
17+
text/css
18+
text/plain
19+
text/vnd.wap.wml
20+
application/javascript
21+
application/json
22+
application/rss+xml
23+
application/xml;
24+
25+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
26+
'$status $body_bytes_sent "$http_referer" '
27+
'"$http_user_agent" "$http_x_forwarded_for"';
28+
29+
access_log /var/log/nginx/access.log;
30+
error_log /var/log/nginx/error.log;
31+
32+
keepalive_timeout 20s;
33+
sendfile on;
34+
tcp_nopush on;
35+
36+
gzip on;
37+
gzip_comp_level 5;
38+
gzip_min_length 256;
39+
gzip_proxied any;
40+
gzip_vary on;
41+
gzip_types
42+
application/atom+xml
43+
application/javascript
44+
application/json
45+
application/ld+json
46+
application/manifest+json
47+
application/rss+xml
48+
application/vnd.geo+json
49+
application/vnd.ms-fontobject
50+
application/x-font-ttf
51+
application/x-web-app-manifest+json
52+
application/xhtml+xml
53+
application/xml
54+
font/opentype
55+
image/bmp
56+
image/svg+xml
57+
image/x-icon
58+
text/cache-manifest
59+
text/css
60+
text/plain
61+
text/vcard
62+
text/vnd.rim.location.xloc
63+
text/vtt
64+
text/x-component
65+
text/x-cross-domain-policy;
66+
67+
include sites-enabled/*;
68+
}

deploy/web/php.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
date.timezone = Asia/Jakarta
2+
upload_max_filesize = 100M
3+
post_max_size = 100M

0 commit comments

Comments
 (0)