Skip to content

Commit

Permalink
Merge pull request #74 from ZeusWPI/todo/docker
Browse files Browse the repository at this point in the history
Add improved docker setup
  • Loading branch information
maartenvn authored Dec 10, 2020
2 parents b2ff612 + cee6406 commit 6e6b5be
Show file tree
Hide file tree
Showing 17 changed files with 112 additions and 155 deletions.
3 changes: 0 additions & 3 deletions .dockerignore

This file was deleted.

5 changes: 0 additions & 5 deletions .env.pages

This file was deleted.

5 changes: 0 additions & 5 deletions .env.production

This file was deleted.

29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

18 changes: 0 additions & 18 deletions Dockerfile

This file was deleted.

20 changes: 0 additions & 20 deletions Dockerfile-prod

This file was deleted.

16 changes: 16 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM node:lts-alpine as build-stage

# Make the 'app' folder the current working directory
WORKDIR /app

# Add `/app/node_modules/.bin` to $PATH
ENV PATH /app/node_modules/.bin:$PATH

# Copy package json
COPY package.json /app/package.json

# Install project dependencies
RUN yarn install

# Start development server
CMD ["yarn", "dev"]
34 changes: 34 additions & 0 deletions Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
############################
# Build stage
############################
FROM node:lts-alpine as build-stage

# Environment
ENV NODE_ENV=production \
VUE_APP_BACKEND_URL=https://g2-api.zeus.gent \
VUE_APP_ROUTER_MODE=hash

# Make the 'app' folder the current working directory
WORKDIR /app

# Copy project files and folders to the current working directory (i.e. 'app' folder)
COPY . .

# Install project dependencies
RUN yarn install --production=false

# Build app for production with minification
RUN yarn build

############################
# Production stage
############################
FROM nginx:stable-alpine as production-stage

# Copy the files from the build stage to the production stage
COPY --from=build-stage /app/dist /usr/share/nginx/html

# Expose ports
EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]
13 changes: 13 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: "3.7"

services:
g2-frontend:
container_name: g2-frontend
build:
context: .
dockerfile: Dockerfile.dev
volumes:
- ".:/app"
- "/app/node_modules"
ports:
- "8080:8080"
10 changes: 10 additions & 0 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: "3.7"

services:
g2-frontend-prod:
container_name: g2-frontend-prod
build:
context: .
dockerfile: Dockerfile.prod
ports:
- "4201:80"
15 changes: 0 additions & 15 deletions local.docker-compose.yml

This file was deleted.

17 changes: 0 additions & 17 deletions nginx/nginx.conf

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"dev": "vue-cli-service serve",
"build": "vue-cli-service build --mode production",
"lint": "vue-cli-service lint",
"build:analyze": "yarn build --report",
Expand Down
10 changes: 0 additions & 10 deletions prod.docker-compose.yml

This file was deleted.

2 changes: 1 addition & 1 deletion src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const routes: Array<RouteConfig> = [
];

const router = new VueRouter({
mode: process.env.VUE_APP_ROUTER_MODE,
mode: process.env.VUE_APP_ROUTER_MODE || "history",
base: process.env.BASE_URL,
routes
});
Expand Down
52 changes: 23 additions & 29 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,25 @@
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"strict": true,
"jsx": "preserve",
"importHelpers": true,
"moduleResolution": "node",
"experimentalDecorators": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strictPropertyInitialization": false,
"resolveJsonModule": true,
"allowJs": true,
"sourceMap": true,
"baseUrl": ".",
"types": ["webpack-env", "vuetify"],
"paths": {
"@/*": ["src/*"]
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"strict": true,
"jsx": "preserve",
"importHelpers": true,
"moduleResolution": "node",
"experimentalDecorators": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strictPropertyInitialization": false,
"resolveJsonModule": true,
"allowJs": true,
"sourceMap": true,
"baseUrl": ".",
"types": ["webpack-env", "vuetify"],
"paths": {
"@/*": ["src/*"]
},
"lib": ["esnext", "dom", "dom.iterable", "scripthost"]
},
"lib": ["esnext", "dom", "dom.iterable", "scripthost"]
},
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.vue",
"tests/**/*.ts",
"tests/**/*.tsx"
],
"exclude": ["node_modules"]
}
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue", "tests/**/*.ts", "tests/**/*.tsx"],
"exclude": ["node_modules"]
}
16 changes: 14 additions & 2 deletions vue.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
/* eslint-disable */
module.exports = {
publicPath: process.env.VUE_APP_PUBLIC_PATH ? process.env.VUE_APP_PUBLIC_PATH : "",
productionSourceMap: process.env.VUE_APP_SOURCEMAP ? Boolean(process.env.VUE_APP_SOURCEMAP) : false
publicPath: process.env.VUE_APP_PUBLIC_PATH || "",
productionSourceMap: process.env.VUE_APP_SOURCEMAP === "true",

/**
* Transpile certain dependencies from ES6 to lower ES versions
* for older browser support (eg: IE11, Safari 9)
*/
transpileDependencies: ["vuetify"],

/**
* Prevent error on compilation when ESLint found errors/warnings.
*/
lintOnSave: "warning"
};

0 comments on commit 6e6b5be

Please sign in to comment.