creates database correctly

This commit is contained in:
benbot 2023-10-27 10:14:51 -04:00
parent e8b528e5f0
commit 5ef40852a6
2 changed files with 9 additions and 6 deletions

View file

@ -27,26 +27,26 @@ ENV NODE_ENV=production
# Use Node.js to install assets # Use Node.js to install assets
FROM node:20 AS node-build FROM node:20 AS node-build
WORKDIR /app/assets WORKDIR /app/assets
COPY assets/package.json assets/pnpm-lock.yaml ./ COPY assets .
RUN npm install -g pnpm RUN npm install -g pnpm
RUN pnpm install RUN pnpm install
COPY assets/ ./
# Switch back to our Elixir image to continue building # Switch back to our Elixir image to continue building
FROM build AS app-build FROM build AS app-build
WORKDIR /app WORKDIR /app
RUN mix ecto.create
RUN mix ecto.migrate
RUN mix phx.digest RUN mix phx.digest
# Copy our application source code # Copy our application source code
COPY --from=node-build /app/assets assets
COPY lib lib COPY lib lib
COPY priv priv COPY priv priv
# Compile and build the application # 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 # Create the release
RUN mix phx.gen.release
RUN mix release RUN mix release
# ---- Application Stage ---- # ---- Application Stage ----
@ -62,6 +62,8 @@ WORKDIR /home/app
# Copy over the build artifact from the previous step and create a symlink # 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/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 # Specify the entry point
ENTRYPOINT ["/home/app/bin/ezcontainer_railway", "start"] ENTRYPOINT ["/home/app/bin/ezcontainer_railway", "start"]

View file

@ -10,10 +10,11 @@ config :ezcontainer_railway, EzcontainerRailway.Repo,
# The watchers configuration can be used to run external # The watchers configuration can be used to run external
# watchers to your application. For example, we can use it # watchers to your application. For example, we can use it
# to bundle .js and .css sources. # to bundle .js and .css sources.
port = String.to_integer(System.get_env("PORT") || "4000")
config :ezcontainer_railway, EzcontainerRailwayWeb.Endpoint, config :ezcontainer_railway, EzcontainerRailwayWeb.Endpoint,
# Binding to loopback ipv4 address prevents access from other machines. # Binding to loopback ipv4 address prevents access from other machines.
# Change to `ip: {0, 0, 0, 0}` to allow 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, check_origin: false,
code_reloader: true, code_reloader: true,
debug_errors: true, debug_errors: true,