-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dockerize the development environment #3
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
/.idea/ | ||
/node_modules |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
/* | ||
|-------------------------------------------------------------------------- | ||
| Browser-sync config file | ||
|-------------------------------------------------------------------------- | ||
| | ||
| For up-to-date information about the options: | ||
| http://www.browsersync.io/docs/options/ | ||
| | ||
| There are more options than you see here, these are just the ones that are | ||
| set internally. See the website for more info. | ||
| | ||
| | ||
*/ | ||
module.exports = { | ||
"ui": { | ||
"port": 3131 | ||
}, | ||
"files": [ | ||
'swagger.yaml' | ||
], | ||
"watchEvents": [ | ||
"change" | ||
], | ||
"watch": true, | ||
"ignore": [], | ||
"single": false, | ||
"watchOptions": { | ||
"ignoreInitial": true, | ||
"usePolling": true | ||
}, | ||
"server": false, | ||
"proxy": false, | ||
"port": 3000, | ||
"middleware": false, | ||
"serveStatic": [], | ||
"ghostMode": { | ||
"clicks": true, | ||
"scroll": true, | ||
"location": true, | ||
"forms": { | ||
"submit": true, | ||
"inputs": true, | ||
"toggles": true | ||
} | ||
}, | ||
"logLevel": "info", | ||
"logPrefix": "Browsersync", | ||
"logConnections": false, | ||
"logFileChanges": true, | ||
"logSnippet": true, | ||
"rewriteRules": [], | ||
"open": "local", | ||
"browser": "default", | ||
"cors": true, | ||
"xip": false, | ||
"hostnameSuffix": false, | ||
"reloadOnRestart": false, | ||
"notify": true, | ||
"scrollProportionally": true, | ||
"scrollThrottle": 0, | ||
"scrollRestoreTechnique": "window.name", | ||
"scrollElements": [], | ||
"scrollElementMapping": [], | ||
"reloadDelay": 0, | ||
"reloadDebounce": 0, | ||
"reloadThrottle": 0, | ||
"plugins": [], | ||
"injectChanges": true, | ||
"startPath": null, | ||
"minify": true, | ||
"host": null, | ||
"localOnly": false, | ||
"codeSync": true, | ||
"timestamps": true, | ||
"clientEvents": [ | ||
"scroll", | ||
"scroll:element", | ||
"input:text", | ||
"input:toggles", | ||
"form:submit", | ||
"form:reset", | ||
"click" | ||
], | ||
"socket": { | ||
"socketIoOptions": { | ||
"log": false | ||
}, | ||
"socketIoClientConfig": { | ||
"reconnectionAttempts": 50 | ||
}, | ||
"path": "/browser-sync/socket.io", | ||
"clientPath": "/browser-sync", | ||
"namespace": "/browser-sync", | ||
"clients": { | ||
"heartbeatTimeout": 5000 | ||
} | ||
}, | ||
"tagNames": { | ||
"less": "link", | ||
"scss": "link", | ||
"css": "link", | ||
"jpg": "img", | ||
"jpeg": "img", | ||
"png": "img", | ||
"svg": "img", | ||
"gif": "img", | ||
"js": "script" | ||
}, | ||
"injectNotification": false | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
version: '3.2' | ||
|
||
services: | ||
editor: | ||
image: swaggerapi/swagger-editor | ||
ports: | ||
- 8383:8080 | ||
links: | ||
- ipfs | ||
depends_on: | ||
- ipfs | ||
volumes: | ||
- ./docker/editor/editor-config.js:/usr/share/nginx/html/dist/editor-config.js | ||
- ./docker/editor/index.html:/usr/share/nginx/html/index.html | ||
- ./:/usr/share/nginx/html/data:rw | ||
|
||
ipfs: | ||
image: jbenet/go-ipfs | ||
volumes: | ||
- ./docker/ipfs/start_ipfs.sh:/usr/local/bin/start_ipfs | ||
- ./docker/ipfs/config_ipfs.sh:/usr/local/bin/config_ipfs | ||
ports: | ||
- 5001:5001 | ||
- 4001:4001 | ||
- 8080:8080 | ||
expose: | ||
- 5001 | ||
- 4001 | ||
- 8080 | ||
links: | ||
- browsersync | ||
depends_on: | ||
- browsersync | ||
|
||
browsersync: | ||
build: | ||
context: docker/browsersync | ||
ports: | ||
- 3131:3131 | ||
- 3000:3000 | ||
expose: | ||
- 3131 | ||
- 3000 | ||
working_dir: /data/browsersynced | ||
volumes: | ||
- ./:/data/browsersynced:rw |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM alpine:3.4 | ||
|
||
MAINTAINER Jules Aaelio | ||
|
||
RUN apk add --update nodejs | ||
|
||
CMD npm install && npm start | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see a copy of package.json in the Dockerfile, meaning this Dockerfile doesn't work on its own: the |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
window.onload = function () { | ||
// Build a system | ||
const editor = SwaggerEditorBundle({ | ||
url: './data/swagger.yaml', | ||
dom_id: '#swagger-editor', | ||
layout: 'StandaloneLayout', | ||
presets: [ | ||
SwaggerEditorStandalonePreset | ||
], | ||
}); | ||
window.editor = editor | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<!DOCTYPE html> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we could ship these files within a docker image and only mount the config as a volume. |
||
<!-- HTML for static distribution bundle build --> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Swagger Editor</title> | ||
<style> | ||
* { | ||
box-sizing: border-box; | ||
} | ||
|
||
body { | ||
font-family: Roboto, sans-serif; | ||
font-size: 9px; | ||
line-height: 1.42857143; | ||
color: #444; | ||
margin: 0px; | ||
} | ||
|
||
#swagger-editor { | ||
font-size: 1.3em; | ||
} | ||
|
||
.container { | ||
height: 100%; | ||
max-width: 880px; | ||
margin-left: auto; | ||
margin-right: auto; | ||
} | ||
|
||
#editor-wrapper { | ||
height: 100%; | ||
border: 1em solid #000; | ||
border: none; | ||
} | ||
|
||
.Pane2 { | ||
overflow-y: scroll; | ||
} | ||
</style> | ||
<link href="./dist/swagger-editor.css" rel="stylesheet"> | ||
<link rel="icon" type="image/png" href="./dist/favicon-32x32.png" sizes="32x32"/> | ||
<link rel="icon" type="image/png" href="./dist/favicon-16x16.png" sizes="16x16"/> | ||
</head> | ||
|
||
<body> | ||
<div id="swagger-editor"></div> | ||
<script src="./dist/swagger-editor-bundle.js"></script> | ||
<script src="./dist/swagger-editor-standalone-preset.js"></script> | ||
<script src="./dist/editor-config.js"></script> | ||
<script id="__bs_script__">//<![CDATA[ | ||
document.write("<script async src='http://HOST:3000/browser-sync/browser-sync-client.js?v=2.24.5'><\/script>".replace("HOST", location.hostname)); | ||
//]]></script> | ||
|
||
|
||
<svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" | ||
style="position:absolute;width:0;height:0"> | ||
<defs> | ||
<symbol viewBox="0 0 20 20" id="unlocked"> | ||
<path | ||
d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V6h2v-.801C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8z"></path> | ||
</symbol> | ||
|
||
<symbol viewBox="0 0 20 20" id="locked"> | ||
<path | ||
d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8zM12 8H8V5.199C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8z"/> | ||
</symbol> | ||
|
||
<symbol viewBox="0 0 20 20" id="close"> | ||
<path | ||
d="M14.348 14.849c-.469.469-1.229.469-1.697 0L10 11.819l-2.651 3.029c-.469.469-1.229.469-1.697 0-.469-.469-.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-.469-.469-.469-1.228 0-1.697.469-.469 1.228-.469 1.697 0L10 8.183l2.651-3.031c.469-.469 1.228-.469 1.697 0 .469.469.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c.469.469.469 1.229 0 1.698z"/> | ||
</symbol> | ||
|
||
<symbol viewBox="0 0 20 20" id="large-arrow"> | ||
<path | ||
d="M13.25 10L6.109 2.58c-.268-.27-.268-.707 0-.979.268-.27.701-.27.969 0l7.83 7.908c.268.271.268.709 0 .979l-7.83 7.908c-.268.271-.701.27-.969 0-.268-.269-.268-.707 0-.979L13.25 10z"/> | ||
</symbol> | ||
|
||
<symbol viewBox="0 0 20 20" id="large-arrow-down"> | ||
<path | ||
d="M17.418 6.109c.272-.268.709-.268.979 0s.271.701 0 .969l-7.908 7.83c-.27.268-.707.268-.979 0l-7.908-7.83c-.27-.268-.27-.701 0-.969.271-.268.709-.268.979 0L10 13.25l7.418-7.141z"/> | ||
</symbol> | ||
|
||
|
||
<symbol viewBox="0 0 24 24" id="jump-to"> | ||
<path d="M19 7v4H5.83l3.58-3.59L8 6l-6 6 6 6 1.41-1.41L5.83 13H21V7z"/> | ||
</symbol> | ||
|
||
<symbol viewBox="0 0 24 24" id="expand"> | ||
<path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/> | ||
</symbol> | ||
|
||
</defs> | ||
</svg> | ||
|
||
</body> | ||
|
||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh | ||
|
||
ipfs config Addresses.API /ip4/0.0.0.0/tcp/5001 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you choose this method over the ipfs config file one? |
||
ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/8080 | ||
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]' | ||
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["GET","POST","PUT"]' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/sh | ||
set -e | ||
user=ipfs | ||
repo="$IPFS_PATH" | ||
|
||
if [ `id -u` -eq 0 ]; then | ||
echo "Changing user to $user" | ||
# ensure folder is writable | ||
su-exec "$user" test -w "$repo" || chown -R -- "$user" "$repo" | ||
# restart script with new privileges | ||
exec su-exec "$user" "$0" "$@" | ||
fi | ||
|
||
# 2nd invocation with regular user | ||
ipfs version | ||
|
||
if [ -e "$repo/config" ]; then | ||
echo "Found IPFS fs-repo at $repo" | ||
else | ||
ipfs init | ||
fi | ||
|
||
# if the first argument is daemon | ||
if [ "$1" = "daemon" ]; then | ||
# filter the first argument until | ||
# https://github.com/ipfs/go-ipfs/pull/3573 | ||
# has been resolved | ||
shift | ||
else | ||
# print deprecation warning | ||
# go-ipfs used to hardcode "ipfs daemon" in it's entrypoint | ||
# this workaround supports the new syntax so people start setting daemon explicitly | ||
# when overwriting CMD | ||
echo "DEPRECATED: arguments have been set but the first argument isn't 'daemon'" >&2 | ||
echo "DEPRECATED: run 'docker run ipfs/go-ipfs daemon $@' instead" >&2 | ||
echo "DEPRECATED: see the following PRs for more information:" >&2 | ||
echo "DEPRECATED: * https://github.com/ipfs/go-ipfs/pull/3573" >&2 | ||
echo "DEPRECATED: * https://github.com/ipfs/go-ipfs/pull/3685" >&2 | ||
fi | ||
|
||
config_ipfs | ||
exec ipfs daemon "$@" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"name": "ipfs-swagger", | ||
"version": "1.0.0", | ||
"description": "**IPFS** Rest API swagger specification document in Yml and Json (OpenAPI).", | ||
"main": "index.js", | ||
"directories": { | ||
"doc": "docs" | ||
}, | ||
"scripts": { | ||
"start": "browser-sync start --config bs-config.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/LePetitBloc/ipfs-swagger.git" | ||
}, | ||
"keywords": [ | ||
"ipfs", | ||
"swagger", | ||
"swagger-editor", | ||
"docker" | ||
], | ||
"author": "JulesAaelio", | ||
"license": "ISC", | ||
"bugs": { | ||
"url": "https://github.com/LePetitBloc/ipfs-swagger/issues" | ||
}, | ||
"homepage": "https://github.com/LePetitBloc/ipfs-swagger#readme", | ||
"devDependencies": { | ||
"browser-sync": "^2.24.5" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's only for node, use a node alpine official image instead.