From 5ef40852a62ef833ed554b0f33950a4c50f164eb Mon Sep 17 00:00:00 2001 From: benbot Date: Fri, 27 Oct 2023 10:14:51 -0400 Subject: [PATCH] creates database correctly --- Dockerfile | 12 +++++++----- config/dev.exs | 3 ++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6325cc3..1c27914 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,26 +27,26 @@ ENV NODE_ENV=production # Use Node.js to install assets FROM node:20 AS node-build WORKDIR /app/assets -COPY assets/package.json assets/pnpm-lock.yaml ./ +COPY assets . RUN npm install -g pnpm RUN pnpm install -COPY assets/ ./ # Switch back to our Elixir image to continue building FROM build AS app-build WORKDIR /app -RUN mix ecto.create -RUN mix ecto.migrate RUN mix phx.digest # Copy our application source code +COPY --from=node-build /app/assets assets COPY lib lib COPY priv priv # Compile and build the application -RUN mix do compile, phx.digest +RUN mix do compile, phx.digest, assets.deploy, ecto.create, ecto.migrate # Create the release +RUN mix phx.gen.release + RUN mix release # ---- Application Stage ---- @@ -62,6 +62,8 @@ WORKDIR /home/app # Copy over the build artifact from the previous step and create a symlink COPY --from=app-build --chown=app:app /app/_build/prod/rel/ezcontainer_railway ./ +COPY --from=app-build --chown=app:app /app/_build/prod/lib/ezcontainer_railway/priv/static priv/static +COPY --from=app-build --chown=app:app /app/db ./db # Specify the entry point ENTRYPOINT ["/home/app/bin/ezcontainer_railway", "start"] diff --git a/config/dev.exs b/config/dev.exs index 91a6e89..82ac323 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -10,10 +10,11 @@ config :ezcontainer_railway, EzcontainerRailway.Repo, # The watchers configuration can be used to run external # watchers to your application. For example, we can use it # to bundle .js and .css sources. +port = String.to_integer(System.get_env("PORT") || "4000") config :ezcontainer_railway, EzcontainerRailwayWeb.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: {0, 0, 0, 0}, port: port], check_origin: false, code_reloader: true, debug_errors: true,