docker支持

This commit is contained in:
曹强
2019-10-20 21:59:53 +08:00
parent 73a4db9351
commit dab3430d6e
8 changed files with 159 additions and 88 deletions
+39
View File
@@ -0,0 +1,39 @@
version: "3"
services:
exam-admin:
build: ./source/vue/exam-admin/
image: exam-admin
environment:
- PORT=8181
- VUE_APP_URL=http://localhost:8001
- VUE_APP_API=http://localhost:8181
expose:
- "8181"
ports:
- 8181:8181
links:
- exam-server
exam-student:
build: ./source/vue/exam-student/
image: exam-student
environment:
- PORT=8182
- VUE_APP_URL=http://localhost:8001
- VUE_APP_API=http://localhost:8182
expose:
- "8182"
ports:
- 8182:8182
exam-server:
build: ./source/exam/
image: exam-server
expose:
- "8001"
ports:
- 8001:8001
redis:
image: redis:alpine
expose:
- "6379"
ports:
- 6379:6379
+10
View File
@@ -0,0 +1,10 @@
FROM maven:3.6.2-jdk-8
MAINTAINER caoqiang<caoqiang@jiuqi.com.cn>
#ADD pom.xml /app/
#ADD src/ /app/src/
WORKDIR /app/
#RUN mvn package -Pdev
ADD target/exam-2.0.1.jar target/exam-2.0.1.jar
CMD ["java","-jar","target/exam-2.0.1.jar"]
+3
View File
@@ -0,0 +1,3 @@
**/node_modules
**/dist
**/package-lock.json
+8
View File
@@ -0,0 +1,8 @@
FROM node:8.12
WORKDIR /app
COPY package.json /app/package.json
RUN npm config set registry https://registry.npm.taobao.org
RUN npm install -g cnpm --registry=https://registry.npm.taobao.org
RUN cnpm install
COPY . /app
CMD ["npm", "run", "serve"]
+44 -44
View File
@@ -1,51 +1,51 @@
'use strict'
const path = require('path')
function resolve (dir) {
return path.join(__dirname, dir)
function resolve(dir) {
return path.join(__dirname, dir)
}
module.exports = {
publicPath: './',
outputDir: 'dist',
assetsDir: 'static',
lintOnSave: true,
devServer: {
open: true,
host: 'localhost',
port: 81,
https: false,
hotOnly: false,
proxy: {
'/api': {
target: process.env.VUE_APP_API,
changeOrigin: true
}
publicPath: './',
outputDir: 'dist',
assetsDir: 'static',
lintOnSave: true,
devServer: {
open: true,
host: '0.0.0.0',
port: process.env.PORT,
https: false,
hotOnly: false,
proxy: {
'/api': {
target: process.env.VUE_APP_API,
changeOrigin: true
}
}
},
pages: {
index: {
entry: 'src/main.js',
template: 'public/index.html',
filename: 'index.html'
}
},
chainWebpack(config) {
// set svg-sprite-loader
config.module
.rule('svg')
.exclude.add(resolve('src/icons'))
.end()
config.module
.rule('icons')
.test(/\.svg$/)
.include.add(resolve('src/icons'))
.end()
.use('svg-sprite-loader')
.loader('svg-sprite-loader')
.options({
symbolId: 'icon-[name]'
})
.end()
}
},
pages: {
index: {
entry: 'src/main.js',
template: 'public/index.html',
filename: 'index.html'
}
},
chainWebpack (config) {
// set svg-sprite-loader
config.module
.rule('svg')
.exclude.add(resolve('src/icons'))
.end()
config.module
.rule('icons')
.test(/\.svg$/)
.include.add(resolve('src/icons'))
.end()
.use('svg-sprite-loader')
.loader('svg-sprite-loader')
.options({
symbolId: 'icon-[name]'
})
.end()
}
}
}
+3
View File
@@ -0,0 +1,3 @@
**/node_modules
**/dist
**/package-lock.json
+8
View File
@@ -0,0 +1,8 @@
FROM node:8.12
WORKDIR /app
COPY package.json /app/package.json
RUN npm config set registry https://registry.npm.taobao.org
RUN npm install -g cnpm --registry=https://registry.npm.taobao.org
RUN cnpm install
COPY . /app
CMD ["npm", "run", "serve"]
+44 -44
View File
@@ -1,51 +1,51 @@
'use strict'
const path = require('path')
function resolve (dir) {
return path.join(__dirname, dir)
function resolve(dir) {
return path.join(__dirname, dir)
}
module.exports = {
publicPath: './',
outputDir: 'dist',
assetsDir: 'static',
lintOnSave: true,
devServer: {
open: true,
host: 'localhost',
port: 80,
https: false,
hotOnly: false,
proxy: {
'/api': {
target: process.env.VUE_APP_API,
changeOrigin: true
}
publicPath: './',
outputDir: 'dist',
assetsDir: 'static',
lintOnSave: true,
devServer: {
open: true,
host: '0.0.0.0',
port: process.env.PORT,
https: false,
hotOnly: false,
proxy: {
'/api': {
target: process.env.VUE_APP_API,
changeOrigin: true
}
}
},
pages: {
index: {
entry: 'src/main.js',
template: 'public/index.html',
filename: 'index.html'
}
},
chainWebpack(config) {
// set svg-sprite-loader
config.module
.rule('svg')
.exclude.add(resolve('src/icons'))
.end()
config.module
.rule('icons')
.test(/\.svg$/)
.include.add(resolve('src/icons'))
.end()
.use('svg-sprite-loader')
.loader('svg-sprite-loader')
.options({
symbolId: 'icon-[name]'
})
.end()
}
},
pages: {
index: {
entry: 'src/main.js',
template: 'public/index.html',
filename: 'index.html'
}
},
chainWebpack (config) {
// set svg-sprite-loader
config.module
.rule('svg')
.exclude.add(resolve('src/icons'))
.end()
config.module
.rule('icons')
.test(/\.svg$/)
.include.add(resolve('src/icons'))
.end()
.use('svg-sprite-loader')
.loader('svg-sprite-loader')
.options({
symbolId: 'icon-[name]'
})
.end()
}
}
}