Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Elixir sample * Change Dockerfile to add files to /app * Change README.md link to "Google App Engine" * Add /cover, /doc, /.fetch, erl_crash.dump to .dockerignore
- Loading branch information
Showing
9 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# The directory Mix will write compiled artifacts to. | ||
/_build | ||
|
||
# If you run "mix test --cover", coverage assets end up here. | ||
/cover | ||
|
||
# The directory Mix downloads your dependencies sources to. | ||
/deps | ||
|
||
# Where 3rd-party dependencies like ExDoc output generated docs. | ||
/doc | ||
|
||
# Ignore .fetch files in case you like to edit your project deps locally. | ||
/.fetch | ||
|
||
# If the VM crashes, it generates a dump, let's ignore it too. | ||
erl_crash.dump |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# The directory Mix will write compiled artifacts to. | ||
/_build | ||
|
||
# If you run "mix test --cover", coverage assets end up here. | ||
/cover | ||
|
||
# The directory Mix downloads your dependencies sources to. | ||
/deps | ||
|
||
# Where 3rd-party dependencies like ExDoc output generated docs. | ||
/doc | ||
|
||
# Ignore .fetch files in case you like to edit your project deps locally. | ||
/.fetch | ||
|
||
# If the VM crashes, it generates a dump, let's ignore it too. | ||
erl_crash.dump | ||
|
||
# Also ignore archive artifacts (built via "mix archive.build"). | ||
*.ez | ||
|
||
# Ignore mix.lock to always fetch latest dependencies | ||
mix.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Use the latest Elixir image from Docker Hub | ||
FROM elixir | ||
|
||
# Add current Mix project | ||
ADD . /app | ||
WORKDIR /app | ||
|
||
# Install package managers | ||
RUN mix local.hex --force | ||
RUN mix local.rebar --force | ||
|
||
# Fetch dependencies | ||
RUN mix deps.get | ||
|
||
# Compile and run the app | ||
ENTRYPOINT ["mix", "run", "--no-halt"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Elixir Custom Runtime for App Engine | ||
|
||
Simple sample of an [Elixir](http://elixir-lang.org) (Plug + Cowboy) app that runs on [Google App Engine](https://cloud.google.com/appengine). | ||
|
||
## Run locally | ||
|
||
$ mix deps.get | ||
$ mix run --no-halt | ||
|
||
## Deploy | ||
|
||
$ gcloud app deploy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
runtime: custom | ||
env: flex |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
use Mix.Config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
defmodule MyApp do | ||
use Application | ||
|
||
def start(_type, _args) do | ||
Plug.Adapters.Cowboy.http(MyApp.Router, [], [port: 8080]) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
defmodule MyApp.Router do | ||
import Plug.Conn | ||
|
||
def init(opts), do: opts | ||
|
||
def call(%Plug.Conn{request_path: "/_ah/health"} = conn, _opts) do | ||
send_resp(conn, 200, "👌") | ||
end | ||
def call(conn, _opts) do | ||
send_resp(conn, 200, "Elixir running on Google App Engine!") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
defmodule MyApp.Mixfile do | ||
use Mix.Project | ||
|
||
def project do | ||
[app: :my_app, | ||
version: "0.1.0", | ||
elixir: "~> 1.4", | ||
build_embedded: Mix.env == :prod, | ||
start_permanent: Mix.env == :prod, | ||
deps: deps()] | ||
end | ||
|
||
def application do | ||
[mod: {MyApp, []}] | ||
end | ||
|
||
defp deps do | ||
[{:plug, "~> 1.0"}, | ||
{:cowboy, "~> 1.0"}] | ||
end | ||
end |