Merge pull request #5 from CloudFire-LLC/docker-compose-up

docker-compose up is working
This commit is contained in:
Jamil
2020-04-27 17:11:46 -07:00
committed by GitHub
5 changed files with 41 additions and 12 deletions

View File

@@ -18,7 +18,6 @@ WORKDIR /app
RUN mix local.hex --force
RUN mix local.rebar --force
COPY config config
COPY mix.* ./
COPY $PHOENIX_DIR/mix.* $PHOENIX_DIR/
@@ -27,6 +26,8 @@ COPY apps/system_engine/mix.* ./apps/system_engine/
RUN mix deps.get
RUN mix deps.compile
COPY config config
# Build assets
COPY $PHOENIX_DIR/assets $PHOENIX_DIR/assets
COPY $PHOENIX_DIR/priv $PHOENIX_DIR/priv
@@ -36,13 +37,15 @@ RUN mix phx.digest
# Build project
COPY $PHOENIX_DIR/lib $PHOENIX_DIR/lib
COPY apps/system_engine/lib ./apps/system_engine/
COPY apps/system_engine/lib ./apps/system_engine/lib
RUN mix compile
# Build releases
RUN mix release cf_phx
RUN mix release system_engine
COPY bin bin
# The built application is now contained in _build/
@@ -58,7 +61,9 @@ ENV PORT=4000 \
RUN mkdir /app
WORKDIR /app
COPY --from=builder /app/_build/prod/rel/cf_phx /app/_build/prod/rel/system_engine ./
COPY --from=builder /app/_build/prod/rel/cf_phx ./cf_phx
COPY --from=builder /app/_build/prod/rel/system_engine ./system_engine
COPY --from=builder /app/bin ./bin
RUN chown -R nobody: /app
USER nobody

7
bin/start_cf_phx.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env sh
# migrate DB
cf_phx/bin/cf_phx eval "CfPhx.Release.migrate"
# start app
cf_phx/bin/cf_phx start

View File

@@ -11,11 +11,6 @@ database_url =
For example: ecto://USER:PASS@HOST/DATABASE
"""
config :cf_phx, CfPhx.Repo,
# ssl: true,
url: database_url,
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10")
secret_key_base =
System.get_env("SECRET_KEY_BASE") ||
raise """
@@ -23,6 +18,11 @@ secret_key_base =
You can generate one by calling: mix phx.gen.secret
"""
config :cf_phx, CfPhx.Repo,
# ssl: true,
url: database_url,
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10")
config :cf_phx, CfPhxWeb.Endpoint,
http: [
port: String.to_integer(System.get_env("PORT") || "4000"),

View File

@@ -2,7 +2,9 @@
version: "3.3"
services:
cf-phx:
command: /app/bin/cf_phx start
depends_on:
- db
command: ["bin/start_cf_phx.sh"]
image: cloudfirellc/cloudfire:latest
environment:
DATABASE_URL: ecto://postgres:postgres@db/cloudfire
@@ -11,14 +13,25 @@ services:
# Change this for production systems!
# !!!!!!!!!!!!!
SECRET_KEY_BASE: vw5YEoG6Pb7mCQEC41DjJXIB6v1/tOxO+3YLN+5k+PILkcFMN54g22KXZr6o65Bn
ERL_COOKIE: bSHTSulle4fn4ZgH3CgT6gEEtLiH9leOh1Ykeo4JEEyG31aeDZnDwEWCIhEKM0kF
ports:
- 4000:4000
networks:
- cloudfire
system-engine:
command: /app/bin/system_engine start
depends_on:
- db
command: ["system_engine/bin/system_engine", "start"]
image: cloudfirellc/cloudfire:latest
environment:
DATABASE_URL: ecto://postgres:postgres@db/cloudfire
# !! WARNING !!
# Change these for production systems!
# !!!!!!!!!!!!!
SECRET_KEY_BASE: vw5YEoG6Pb7mCQEC41DjJXIB6v1/tOxO+3YLN+5k+PILkcFMN54g22KXZr6o65Bn
ERL_COOKIE: bSHTSulle4fn4ZgH3CgT6gEEtLiH9leOh1Ykeo4JEEyG31aeDZnDwEWCIhEKM0kF
networks:
- cloudfire

View File

@@ -9,10 +9,14 @@ defmodule CloudfireUmbrella.MixProject do
deps: deps(),
releases: [
cf_phx: [
applications: [cf_phx: :permanent]
applications: [cf_phx: :permanent],
include_executables_for: [:unix],
cookie: System.get_env("ERL_COOKIE")
],
system_engine: [
applications: [system_engine: :permanent]
applications: [system_engine: :permanent],
include_executables_for: [:unix],
cookie: System.get_env("ERL_COOKIE")
]
]
]