miolab / phoenix_dev_containers_no_ecto

Phoenixのno-ecto版Docker開発用リポジトリ
0 stars 0 forks source link
cicd circleci docker elixir phoenix

Phoenix Dev experiment containers (No Ecto)

miolab

Elixir製Webフレームワーク Phoenix--no-ectoDocker 開発環境を構築します

実行環境・バージョン

確認URL


ビルド〜Phoenixプロジェクト作成

$ docker-compose build
$ docker-compose run --rm app mix phx.new . --app my_app --no-ecto

Creating phoenix_dev_containers_no_ecto_app_run ... done
The directory /usr/src/app already exists. Are you sure you want to continue? [Yn]
* creating config/config.exs
* creating config/dev.exs
* creating config/prod.exs
* creating config/prod.secret.exs
* creating config/test.exs
* creating lib/my_app/application.ex
* creating lib/my_app.ex
* creating lib/my_app_web/channels/user_socket.ex
* creating lib/my_app_web/views/error_helpers.ex
* creating lib/my_app_web/views/error_view.ex
* creating lib/my_app_web/endpoint.ex
* creating lib/my_app_web/router.ex
* creating lib/my_app_web/telemetry.ex
* creating lib/my_app_web.ex
* creating mix.exs
* creating README.md
* creating .formatter.exs
* creating .gitignore
* creating test/support/channel_case.ex
* creating test/support/conn_case.ex
* creating test/test_helper.exs
* creating test/my_app_web/views/error_view_test.exs
* creating lib/my_app_web/controllers/page_controller.ex
* creating lib/my_app_web/templates/layout/app.html.eex
* creating lib/my_app_web/templates/page/index.html.eex
* creating lib/my_app_web/views/layout_view.ex
* creating lib/my_app_web/views/page_view.ex
* creating test/my_app_web/controllers/page_controller_test.exs
* creating test/my_app_web/views/layout_view_test.exs
* creating test/my_app_web/views/page_view_test.exs
* creating lib/my_app_web/gettext.ex
* creating priv/gettext/en/LC_MESSAGES/errors.po
* creating priv/gettext/errors.pot
* creating assets/webpack.config.js
* creating assets/.babelrc
* creating assets/js/app.js
* creating assets/css/app.scss
* creating assets/js/socket.js
* creating assets/package.json
* creating assets/static/favicon.ico
* creating assets/css/phoenix.css
* creating assets/static/images/phoenix.png
* creating assets/static/robots.txt

Fetch and install dependencies? [Yn]
* running mix deps.get
* running mix deps.compile
* running cd assets && npm install && node node_modules/webpack/bin/webpack.js --mode development

We are almost there! The following steps are missing:

    $ cd app

Start your Phoenix app with:

    $ mix phx.server

You can also run your app inside IEx (Interactive Elixir) as:

    $ iex -S mix phx.server
$ docker-compose up -d
$ docker-compose ps

                Name                              Command               State           Ports
------------------------------------------------------------------------------------------------------
phoenix_dev_containers_no_ecto_app_1   sh -c mix phx.server --no-halt   Up      0.0.0.0:4000->4000/tcp

ブラウザ確認

フォーマッティングとテスト

$ docker-compose exec app bash -c "mix format"
$ docker-compose exec app bash -c "MIX_ENV=test mix test"

...

Finished in 0.3 seconds
3 tests, 0 failures

Randomized with seed 213195

新規ページ追加

新規ページ /watchme を追加します

ブラウザ確認


(補足) プロジェクト・コンテナ環境削除

$ docker-compose down --rmi all --volumes --remove-orphans

$ rm -rf app/my_app

参考情報