Skip to content

Commit

Permalink
compose
Browse files Browse the repository at this point in the history
  • Loading branch information
ideaMarcos committed Jan 24, 2025
1 parent 97236dd commit fe8fa12
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 16 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,14 @@ COPY config/runtime.exs config/
COPY rel rel
RUN mix release --path ./build
RUN mix ecto.setup
RUN sqlite3 boneyard.db 'PRAGMA wal_checkpoint(TRUNCATE);'

# start a new build stage so that the final image will only contain
# the compiled release and other runtime necessities
FROM ${RUNNER_IMAGE}

RUN apt-get update -y && \
apt-get install -y libstdc++6 openssl libncurses5 locales ca-certificates sqlite3 tini \
apt-get install -y libstdc++6 openssl libncurses5 locales ca-certificates tini \
&& apt-get clean && rm -f /var/lib/apt/lists/*_*

# Set the locale
Expand All @@ -88,7 +89,7 @@ ENV MIX_ENV="prod"

# Only copy the final release from the build stage
COPY --from=builder --chown=nobody:root /app/build ./
COPY --from=builder --chown=nobody:root /app/*.db* ./bin
COPY --from=builder --chown=nobody:root /app/*.db ./bin

USER nobody

Expand Down
2 changes: 1 addition & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ config :boneyard, Oban,

# Configures the endpoint
config :boneyard, BoneyardWeb.Endpoint,
url: [host: "localhost", port: 4000, scheme: "http"],
url: [host: "localhost"],
adapter: Bandit.PhoenixAdapter,
render_errors: [
formats: [html: BoneyardWeb.ErrorHTML, json: BoneyardWeb.ErrorJSON],
Expand Down
2 changes: 1 addition & 1 deletion config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ config :boneyard, Boneyard.Repo,
config :boneyard, BoneyardWeb.Endpoint,
# Binding to loopback ipv4 address prevents access from other machines.
# Change to `ip: {0, 0, 0, 0}` to allow access from other machines.
http: [ip: {127, 0, 0, 1}, port: 4000],
http: [ip: {127, 0, 0, 1}, port: String.to_integer(System.get_env("PORT") || "4000")],
check_origin: false,
code_reloader: true,
debug_errors: true,
Expand Down
8 changes: 8 additions & 0 deletions lib/boneyard.ex
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,13 @@ defmodule Boneyard do
end)
end

def base_uri() do
config = Enum.into(Boneyard.config([BoneyardWeb.Endpoint, :url]), %{})
scheme = Map.get(config, :scheme, "http")
host = Map.get(config, :host, "localhost")
port = Map.get(config, :port, String.to_integer(System.get_env("PORT") || "4000"))
%URI{scheme: scheme, host: host, port: port}
end

def mix_env, do: config([:mix_env])
end
7 changes: 3 additions & 4 deletions lib/boneyard_web/live/game_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,8 @@ defmodule BoneyardWeb.GameLive do
end

defp game_url(game_id) do
%{scheme: scheme, host: host, port: port} =
Enum.into(Boneyard.config([BoneyardWeb.Endpoint, :url]), %{})

URI.to_string(%URI{scheme: scheme, host: host, port: port, path: "/game/join/#{game_id}"})
Boneyard.base_uri()
|> URI.append_path("/game/join/#{game_id}")
|> URI.to_string()
end
end
5 changes: 0 additions & 5 deletions rel/overlays/bin/migrate

This file was deleted.

1 change: 0 additions & 1 deletion rel/overlays/bin/migrate.bat

This file was deleted.

2 changes: 0 additions & 2 deletions rel/overlays/bin/server.bat

This file was deleted.

0 comments on commit fe8fa12

Please sign in to comment.