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

Commit

Permalink
Fix #53 create .mesg folder on daemon:start
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasMahe committed Jun 13, 2019
1 parent 27e5c4d commit ee9f4cd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/docker-command.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {flags} from '@oclif/command'
import {existsSync, mkdirSync} from 'fs'
import {Docker} from 'node-docker-api'
import {Network} from 'node-docker-api/lib/network'
import {homedir} from 'os'
Expand Down Expand Up @@ -82,6 +83,10 @@ export default abstract class extends Command {

async createService(network: Network, options: ServiceOption) {
const image = `mesg/engine:${options.version}`
const sourcePath = join(homedir(), '.mesg')
if (!existsSync(sourcePath)) {
mkdirSync(sourcePath)
}
return this.docker.service.create({
Name: options.name,
Labels: {
Expand All @@ -105,7 +110,7 @@ export default abstract class extends Command {
Target: '/var/run/docker.sock',
Type: 'bind',
}, {
Source: join(homedir(), '.mesg'),
Source: sourcePath,
Target: '/root/.mesg',
Type: 'bind',
}],
Expand Down

0 comments on commit ee9f4cd

Please sign in to comment.