Skip to content

Commit

Permalink
build: 增加 laf-devops-admin 的 docker 构建脚本;
Browse files Browse the repository at this point in the history
  • Loading branch information
maslow committed Jul 31, 2021
1 parent 4f95a45 commit 91ef1d0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ services:
- laf

devops_admin:
image: lessx/less-admin:latest
image: lessx/laf-devops-admin:latest
ports:
- 8080:80
networks:
Expand Down
7 changes: 5 additions & 2 deletions scripts/docker-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,24 @@
const fse = require('fs-extra')
const child_process = require('child_process')
const path = require('path')
const { getAppServerVersion, getDevopsServerVersion, images , buildImage} = require('./utils')
const { getAppServerVersion, getDevopsServerVersion, getDevopsAdminVersion, images , buildImage} = require('./utils')

/**
* main function
*/
function main() {

const devopsDockerfile = path.resolve(__dirname, '../packages/devops-server')
console.log(devopsDockerfile)
const devopsVersion = getDevopsServerVersion()
buildImage(devopsDockerfile, `${images.devops}:${devopsVersion}`, `${images.devops}:latest`)

const appDockerfile = path.resolve(__dirname, '../packages/app-server')
const appVersion = getAppServerVersion()
buildImage(appDockerfile, `${images.app}:${appVersion}`, `${images.app}:latest`)

const devopsAdminDockerfile = path.resolve(__dirname, '../packages/devops-admin')
const devopsAdminVersion = getDevopsAdminVersion()
buildImage(devopsAdminDockerfile, `${images.devops_admin}:${devopsAdminVersion}`, `${images.devops_admin}:latest`)
}

main()
10 changes: 9 additions & 1 deletion scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ const child_process = require('child_process')

const images = {
devops: 'lessx/laf-devops-server',
app: 'lessx/laf-app-server'
app: 'lessx/laf-app-server',
devops_admin: 'lessx/laf-devops-admin'
}

function getDevopsServerVersion() {
Expand All @@ -20,6 +21,12 @@ function getAppServerVersion() {
return json?.version
}

function getDevopsAdminVersion() {
const json = require('../packages/devops-admin/package.json')

assert.ok(json)
return json?.version
}


/**
Expand Down Expand Up @@ -67,6 +74,7 @@ function getAppServerVersion() {
module.exports = {
getDevopsServerVersion,
getAppServerVersion,
getDevopsAdminVersion,
buildImage,
pushImage,
images
Expand Down

0 comments on commit 91ef1d0

Please sign in to comment.