Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Commit

Permalink
docs: Develepment with docker
Browse files Browse the repository at this point in the history
  • Loading branch information
nchanged committed Apr 13, 2018
1 parent 839793e commit 59bce47
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/_doc.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"Guides" : [
"guides/working-with-targets.md",
"guides/publishing-to-npm.md",
"guides/debugging-with-vscode.md"
"guides/debugging-with-vscode.md",
"guides/development-with.docker.md"
],
"Plugins" : [
"plugins/css/CSSPlugin.md",
Expand Down
101 changes: 101 additions & 0 deletions docs/guides/development-with.docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Development with docker


There is a trick on how to make docker listen to file changes.
Based on the [issue](https://github.com/fuse-box/fuse-box/issues/1041)


## Configuring
Working task:

```js
task('start:dev', async (ctx) => {
const fuseConfig = ctx.getConfig();

fuseConfig
.bundle('app')
.instructions('> client.tsx')
.watch()
.hmr();

fuseConfig.dev({
port: 4444,
httpServer: true,
root: 'public'
});

return await fuseConfig.run({
chokidar: {
usePolling: true
}
});
});
```

docker-compose.yml:
```
version: "3"
services:
gridplus-takehome-web:
restart: always
container_name: gridplus-takehome
build:
context: .
dockerfile: ./Dockerfile.dev
ports:
- 4444:4444
volumes:
- .:/usr/app
```

For anyone else that uses bot docker and non-docker environments, here are the task that I made so that I can still take advantage of non-polling environments:
```js
task('init:dev', async (ctx) => {
const fuseConfig = ctx.getConfig();

fuseConfig
.bundle('app')
.instructions('> client.tsx')
.watch()
.hmr();

fuseConfig.dev({
port: 4444,
httpServer: true,
root: 'public'
});
});

task('start:dev', ['init:dev'], async (ctx) => {
const fuseConfig = ctx.getConfig();

return await fuseConfig.run();
});

task('start-docker:dev', ['init:dev'], async (ctx) => {
const fuseConfig = ctx.getConfig();

return await fuseConfig.run({
// https://github.com/paulmillr/chokidar
chokidar: {
persistent: true,

ignored: '*.txt',
ignoreInitial: false,
followSymlinks: true,
cwd: '.',
disableGlobbing: false,

usePolling: true,
interval: 75,
binaryInterval: 300,
alwaysStat: false,
depth: 99,
awaitWriteFinish: false,

ignorePermissionErrors: false,
atomic: true
}
});
});
```

0 comments on commit 59bce47

Please sign in to comment.