Skip to content
This repository has been archived by the owner on Aug 14, 2019. It is now read-only.

Commit

Permalink
package.json updated, webp, fonts, docker
Browse files Browse the repository at this point in the history
  • Loading branch information
jsilva-pt committed Feb 24, 2019
1 parent 009f6b4 commit 921d0a7
Showing 44 changed files with 3,874 additions and 3,311 deletions.
36 changes: 14 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
# app
FROM node:10.14.1-alpine as app
FROM node:10.14.1-alpine as build-stage
WORKDIR /app
EXPOSE 8080
CMD yarn install && yarn serve
COPY package*.json ./
COPY . .
RUN \
yarn install && \
yarn build

# storybook
FROM node:10.14.1-alpine as storybook
WORKDIR /app
EXPOSE 8081
CMD yarn install && yarn serve:storybook

# docs
FROM node:10.14.1-alpine as docs
WORKDIR /app
EXPOSE 8082
CMD yarn install && yarn docs:dev

# mock server
FROM node:10.14.1-alpine as mockserver
RUN npm install -g json-server
WORKDIR /data
EXPOSE 8090
CMD json-server --watch db.json --port 8090 --host 0.0.0.0
# production stage
FROM nginx:1.15.2-alpine as production-stage
COPY --from=build-stage /app/dist /var/www
COPY nginx.conf /etc/nginx/nginx.conf
COPY ssl /etc/ssl
EXPOSE 80
EXPOSE 443
CMD ["nginx", "-g", "daemon off;"]
8 changes: 8 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# app
FROM node:10.14.1-alpine as dev-stage
WORKDIR /app

# mock server
FROM node:10.14.1-alpine as mock-server
RUN npm install -g nodemon
WORKDIR /data
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -5,7 +5,8 @@ Some tools like Vue I18n and Vuex are also used in order to make the project sim
to what a real application would be.

## Dockerize for development

https://gist.github.com/jessedearing/2351836
https://superuser.com/questions/437330/how-do-you-add-a-certificate-authority-ca-to-ubuntu
``` bash
docker-compose up

89 changes: 54 additions & 35 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -4,46 +4,65 @@ services:
app:
build:
context: .
dockerfile: Dockerfile
target: app
dockerfile: Dockerfile.dev
target: dev-stage
ports:
- '8080:8080'
volumes:
- '$PWD:/app'
- '.:/app'
# - './configs/nginx/ssl:/app/ssl'
env_file:
- .env
container_name: app
command: sh -c "yarn install && yarn serve"

# storybook:
# build:
# context: .
# dockerfile: Dockerfile.dev
# target: dev-stage
# ports:
# - '8081:8081'
# volumes:
# - '.:/app'
# # - './configs/nginx/ssl:/app/ssl'
# env_file:
# - .env
# container_name: storybook
# command: sh -c "yarn install && yarn serve:storybook"

storybook:
build:
context: .
dockerfile: Dockerfile
target: storybook
ports:
- '8081:8081'
volumes:
- '$PWD:/app'
container_name: storybook


docs:
build:
context: .
dockerfile: Dockerfile
target: docs
ports:
- '8082:8082'
volumes:
- '$PWD:/app'
container_name: docs
# docs:
# build:
# context: .
# dockerfile: Dockerfile.dev
# target: dev-stage
# ports:
# - '8082:8082'
# volumes:
# - '.:/app'
# env_file:
# - .env
# container_name: docs
# command: sh -c "yarn install && yarn serve:docs"
# networks:
# business-area-network:
# aliases:
# - business.jumiapay.local

# mock_server:
# build:
# context: .
# dockerfile: Dockerfile.dev
# target: mock-server
# ports:
# - '8090:3002'
# volumes:
# - '.:/data'
# # - './configs/nginx/ssl:/data/ssl'
# container_name: mock-server
# command: sh -c "yarn install && cd mocks && nodemon server.js"
# networks:
# business-area-network:
# aliases:
# - business.jumiapay.local

mock:
build:
context: .
dockerfile: Dockerfile
target: mockserver
ports:
- '8090:8090'
volumes:
- '$PWD/mock:/data'
container_name: mockserver
90 changes: 90 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# auto detects a good number of processes to run
worker_processes auto;

# Provides the configuration file context in which the directives that affect connection processing are specified.
events {
# Sets the maximum number of simultaneous connections that can be opened by a worker process.
worker_connections 8000;
# Tells the worker to accept multiple connections at a time
multi_accept on;
}


http {
# what times to include
include /etc/nginx/mime.types;
# what is the default one
default_type application/octet-stream;

# Sets the path, format, and configuration for a buffered log write
log_format compression '$remote_addr - $remote_user [$time_local] '
'"$request" $status $upstream_addr '
'"$http_referer" "$http_user_agent"';

server {
listen 80;
server_name paws.local;
return 301 https://$host$request_uri;
}

server {
# listen on port 80
listen 443 ssl http2;
# listen 80;
server_name paws.local;

ssl_certificate /etc/ssl/server.crt;
ssl_certificate_key /etc/ssl/server.key;

# Gzip Settings
gzip on;
gzip_static on; # allows pre-serving of .gz file if it exists
gzip_disable "msie6"; # Disable for user-agent Internet explorer 6. Not supported.
gzip_proxied any; # enable gzip for all proxied requests
gzip_buffers 16 8k; # number and size of buffers to compress a response
gzip_http_version 1.1;
gzip_min_length 256; # Only gzip files of size in bytes
gzip_types text/plain text/css text/html application/javascript application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon;
gunzip on; # Uncompress on the fly

# save logs here
access_log /var/log/nginx/access.log compression;

# where the root here
root /var/www;
# what file to server as index
index index.html index.htm;

location / {
# First attempt to serve request as file, then
# as directory, then fall back to redirecting to index.html
try_files $uri $uri/ /index.html;
}

# Media: images, icons, video, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc|webp)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
}

# Javascript and CSS files
location ~* (service-worker\.js)$ {
add_header 'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
expires off;
proxy_no_cache 1;
}

location ~* \.(?:css|js)$ {
try_files $uri =404;
expires 1y;
access_log off;
add_header Cache-Control "public";
}

# Any route containing a file extension (e.g. /devicesfile.js)
location ~ ^.+\..+$ {
try_files $uri =404;
}
}
}
33 changes: 17 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -6,8 +6,8 @@
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"build:storybook": "vue-cli-service build:storybook -c config/storybook",
"serve:storybook": "vue-cli-service serve:storybook -p 8081 -c config/storybook",
"build:storybook": "vue-cli-service storybook:build -c config/storybook",
"serve:storybook": "vue-cli-service storybook:serve --ci -p 8081 -c config/storybook",
"test:e2e": "vue-cli-service test:e2e",
"test:unit": "vue-cli-service test:unit",
"docs:dev": "vuepress dev -p 8082 docs",
@@ -23,28 +23,29 @@
"vuex": "^3.0.1"
},
"devDependencies": {
"@storybook/addon-actions": "4.0.0-alpha.20",
"@storybook/addon-links": "4.0.0-alpha.20",
"@vue/cli-plugin-babel": "^3.0.1",
"@vue/cli-plugin-e2e-cypress": "^3.2.0",
"@vue/cli-plugin-eslint": "^3.0.1",
"@vue/cli-plugin-pwa": "^3.0.1",
"@vue/cli-plugin-unit-jest": "^3.0.1",
"@vue/cli-service": "^3.0.1",
"@storybook/addon-actions": "^4.1.13",
"@storybook/addon-links": "^4.1.13",
"@vue/cli-plugin-babel": "^3.4.0",
"@vue/cli-plugin-e2e-cypress": "^3.4.0",
"@vue/cli-plugin-eslint": "^3.4.0",
"@vue/cli-plugin-pwa": "^3.0.0",
"@vue/cli-plugin-unit-jest": "^3.4.0",
"@vue/cli-service": "^3.0.4",
"@vue/eslint-config-standard": "^4.0.0",
"@vue/test-utils": "^1.0.0-beta.20",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "^10.0.1",
"babel-jest": "^23.6.0",
"babel-jest": "^24.1.0",
"babel-loader": "^8.0.5",
"eslint": "^5.8.0",
"eslint-plugin-vue": "^5.0.0-0",
"stylus": "^0.54.5",
"stylus-loader": "^3.0.1",
"stylus-loader": "^3.0.2",
"vue-cli-plugin-i18n": "^0.5.1",
"vue-cli-plugin-storybook": "^0.4.8",
"vue-cli-plugin-vuetify": "^0.4.5",
"vue-template-compiler": "^2.5.17",
"vue-cli-plugin-storybook": "^0.5.2",
"vue-cli-plugin-vuetify": "^0.4.6",
"vue-template-compiler": "^2.6.2",
"vuepress": "^0.14.8",
"vuetify-loader": "^1.0.5"
"vuetify-loader": "^1.2.0"
}
}
Binary file added public/fonts/roboto-v18-latin-100.eot
Binary file not shown.
Loading

0 comments on commit 921d0a7

Please sign in to comment.