はじめに
-
Elixir 楽しんでいますか
- José Valim1さんのこんな書き込みがありました
Earthly
Earthly is a syntax for defining your build. It works with your existing build system. Get repeatable and understandable builds today.
- なんだかよくわかっていませんがインストールして使ってみます
-
Earthfile
というものを書くらしいです
インストール
- Installationに従います
- 予めDockerとGitが必要なのだそうです
- いつインストールしたのか忘れましたがインストール済でした
- 私はmacOS 10.15.7 を使いました
$ brew install earthly
$ earthly github.com/earthly/hello-world:main+hello
buildkitd | Starting buildkit daemon as a docker container (earthly-buildkitd)...
buildkitd | ...Done
busybox:1.32.0 | --> Load metadata linux/amd64
g/e/hello-world:main+base | --> FROM busybox:1.32.0
g/e/hello-world:main+base | [ ] resolve docker.io/library/busybox:1.32.0@sha256:bde48e1751173b709090c2539fdf12d6ba64e88ec7a4301591227ce925f3c678 [██████████] resolve docker.io/library/busybox:1.32.0@sha256:bde48e1751173b709090c2539fdf12d6ba64e88ec7a4301591227ce925f3c678 ... 100%
g/e/hello-world:main+base | [██████████] sha256:ea97eb0eb3ec0bbe00d90be500431050af63c31dc0706c2e8fb53e16cff7761f ... 100%
g/e/hello-world:main+base | [ ] extracting sha256:ea97eb0eb3ec0bbe00d90be500431050af63c31dc0706c2e8fb53e16cff7761f ... 0% [██████████] extracting sha256:ea97eb0eb3ec0bbe00d90be500431050af63c31dc0706c2e8fb53e16cff7761f ... 100%
g/e/hello-world:main+hello | --> RUN echo 'Hello, world!'
g/e/hello-world:main+hello | Hello, world!
output | --> exporting outputs
output | [██████████] sending tarballs ... 100%
=========================== SUCCESS ===========================
- インストールできたようです
- 指定している
Earthfile
は以下の通りです
FROM busybox:1.32.0
hello:
RUN echo 'Hello, world!'
Phoenix
$ earthly github.com/<アカウント or グループ>/<リポジトリ>:ブランチ+<target>
という並びだとおもったらばっちりそう2だったので、もう
Earthfile
があるPhoenixを指定してみます
$ earthly -P github.com/phoenixframework/phoenix:master+all
g/p/phoenix:master+test *failed* | 1) test with 1.0.0 serializer Phoenix.Socket.V1.JSONSerializer sends phx_error if a channel server abnormally exits (Phoenix.Integration.LongPollChannelsTest)
g/p/phoenix:master+test *failed* | test/phoenix/integration/long_poll_channels_test.exs:429
g/p/phoenix:master+test *failed* | ** (MatchError) no match of right hand side value: []
g/p/phoenix:master+test *failed* | code: [_phx_reply, _user_entered, _joined, chan_error] = resp.body["messages"]
g/p/phoenix:master+test *failed* | stacktrace:
g/p/phoenix:master+test *failed* | test/phoenix/integration/long_poll_channels_test.exs:446: (test)
g/p/phoenix:master+test *failed* | The following output was logged:
g/p/phoenix:master+test *failed* |
g/p/phoenix:master+test *failed* | 22:46:04.663 [info] JOINED room:test with 1.0.0 serializer Phoenix.Socket.V1.JSONSerializer sends phx_error if a channel server abnormally exits in 44µs
g/p/phoenix:master+test *failed* | Parameters: %{}
g/p/phoenix:master+test *failed* |
g/p/phoenix:master+test *failed* | 22:46:04.815 [error] GenServer #PID<0.5361.0> terminating
g/p/phoenix:master+test *failed* | ** (RuntimeError) boom
g/p/phoenix:master+test *failed* | test/phoenix/integration/long_poll_channels_test.exs:46: Phoenix.Integration.LongPollChannelsTest.RoomChannel.handle_in/3
g/p/phoenix:master+test *failed* | (phoenix 1.6.0-dev) lib/phoenix/channel/server.ex:315: Phoenix.Channel.Server.handle_info/2
g/p/phoenix:master+test *failed* | (stdlib 3.8.2.4) gen_server.erl:637: :gen_server.try_dispatch/4
g/p/phoenix:master+test *failed* | (stdlib 3.8.2.4) gen_server.erl:711: :gen_server.handle_msg/6
g/p/phoenix:master+test *failed* | (stdlib 3.8.2.4) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
g/p/phoenix:master+test *failed* | Last message: %Phoenix.Socket.Message{event: "boom", join_ref: nil, payload: %{}, ref: nil, topic: "room:test with 1.0.0 serializer Phoenix.Socket.V1.JSONSerializer sends phx_error if a channel server abnormally exits"}
g/p/phoenix:master+test *failed* | State: %Phoenix.Socket{assigns: %{user_id: nil}, channel: Phoenix.Integration.LongPollChannelsTest.RoomChannel, channel_pid: #PID<0.5361.0>, endpoint: Phoenix.Integration.LongPollChannelsTest.Endpoint, handler: Phoenix.Integration.LongPollChannelsTest.UserSocket, id: nil, join_ref: "1", joined: true, private: %{log_handle_in: :info, log_join: :info}, pubsub_server: Phoenix.Integration.LongPollChannelsTest, ref: nil, serializer: Phoenix.Socket.V1.JSONSerializer, topic: "room:test with 1.0.0 serializer Phoenix.Socket.V1.JSONSerializer sends phx_error if a channel server abnormally exits", transport: :longpoll, transport_pid: #PID<0.5356.0>}
g/p/phoenix:master+test *failed* |
g/p/phoenix:master+test *failed* | ....................................................................................................................
g/p/phoenix:master+test *failed* | Finished in 128.0 seconds
g/p/phoenix:master+test *failed* | 11 doctests, 737 tests, 1 failure
g/p/phoenix:master+test *failed* | Randomized with seed 43391
g/p/phoenix:master+test *failed* | Command /bin/sh -c 'mix test' failed with exit code 1
g/p/phoenix:master+test *failed* | g/p/phoenix:master+test *failed* | ERROR: Command exited with non-zero code: RUN mix test
-
failed
... -
-P
はつけないとエラーがでたのでつけました
--allow-privileged, -P Allow build to use the --privileged flag in RUN commands
Wrapping Up 🎍🎍🎍🎍🎍
- 今回はインストールして、
Earthfile
があるプロジェクトを指定して動かしてみました - また理解が進んだら記事を書きたいとおもいます
- (Quick Tutorial: Build a Go App in EarthlyのElixir版を陽気に紹介したい)
- Enjoy Elixir 🚀🚀🚀