RUN npm install -g --unsafe-perm strongloop USER docker ENTRYPOINT ["npm", "start"] CMD []
Dockerイメージをビルドします。
$ docker build -t loopback .
slcコマンドからしてアプリを作成します。
$ docker-compose run --rm slc loopback
_-----_ | | .--------------------------. |--(o)--| | Let's create a LoopBack | `---------´ | application! | ( _´U`_ ) '--------------------------' /___A___\ | ~ | __'.___.'__ ´ ` |° ´ Y ` ? What's the name of your application? spike-todo create spike-todo/ info change the working directory to spike-todo ... Next steps:
$ docker-compose run --rm slc loopback:model ? Enter the model name: Todo ? Select the data-source to attach Todo to: mongodb_dev (mongodb) ? Select model's base class: PersistedModel ? Expose Todo via the REST API? Yes ? Custom plural form (used to build REST URL): Todos Let's add some Todo properties now.
Enter an empty property name when done. ? Property name: title invoke loopback:property ? Property type: string ? Required? Yes
Let's add another Todo property. Enter an empty property name when done. ? Property name: completed invoke loopback:property ? Property type: boolean ? Required? No Let's add another Todo property. Enter an empty property name when done. ? Property name: Removing dockerloopback_slc_run_1...
$ docker-compose up server Creating dockerloopback_mongo_1... Creating dockerloopback_server_1... Attaching to dockerloopback_server_1 server_1 | INFO strong-agent v1.6.0 profiling app 'spike-todo' pid '1' server_1 | INFO strong-agent[1] started profiling agent server_1 | INFO supervisor reporting metrics to `internal:` server_1 | supervisor running without clustering (unsupervised) server_1 | INFO strong-agent not profiling, agent metrics requires a valid license. server_1 | Please contact sales@strongloop.com for assistance. server_1 | Browse your REST API at http://0.0.0.0:3000/explorer server_1 | Web server listening at: http://0.0.0.0:3000/